From 5df057b99fd269d8ef657e4b02572ed455fd8f66 Mon Sep 17 00:00:00 2001 From: Lawrence Date: Mon, 30 Sep 2024 13:11:57 +0100 Subject: [PATCH] chore: fix missing jsdoc blocks --- test/assertions.js | 4 ++++ test/mocks/engine.js | 8 ++++++++ test/mocks/fetch.js | 12 ++++++++++++ test/mocks/fs.js | 10 ++++++++++ test/mocks/s3.js | 15 +++++++++++++++ 5 files changed, 49 insertions(+) diff --git a/test/assertions.js b/test/assertions.js index cb818c4..3fa0923 100644 --- a/test/assertions.js +++ b/test/assertions.js @@ -1,6 +1,10 @@ import Model from '../src/type/Model.js'; import {inspect} from 'node:util'; +/** + * @param arg + * @return {*} + */ function parseArgument(arg) { try { if (Model.isModel(arg)) { diff --git a/test/mocks/engine.js b/test/mocks/engine.js index 9ac4bdc..298bb1b 100644 --- a/test/mocks/engine.js +++ b/test/mocks/engine.js @@ -2,6 +2,10 @@ import Engine from '../../src/engine/Engine.js'; import _ from 'lodash'; import sinon from 'sinon'; +/** + * @param models + * @return {TestEngine} + */ export function getTestEngine(models = []) { const _models = {}; const _index = {}; @@ -12,6 +16,10 @@ export function getTestEngine(models = []) { _models[model.id] = _.cloneDeep(model); } + /** + * @class TestEngine + * @extends Engine + */ class TestEngine extends Engine { } diff --git a/test/mocks/fetch.js b/test/mocks/fetch.js index 11cf70f..d7e5dc2 100644 --- a/test/mocks/fetch.js +++ b/test/mocks/fetch.js @@ -2,9 +2,21 @@ import Model from '../../src/type/Model.js'; import lunr from 'lunr'; import sinon from 'sinon'; +/** + * @param filesystem + * @param models + * @param errors + * @param prefix + * @return {void|*} + */ function stubFetch(filesystem = {}, models = [], errors = {}, prefix = '') { const modelsAddedToFilesystem = []; + /** + * @param initialFilesystem + * @param initialModels + * @return {object} + */ function fileSystemFromModels(initialFilesystem = {}, ...initialModels) { for (const model of initialModels) { const modelIndexPath = [prefix, model.id.replace(/[A-Z0-9]+$/, '_index.json')].filter(i => Boolean(i)).join('/'); diff --git a/test/mocks/fs.js b/test/mocks/fs.js index 9c7ba7d..df9c9b1 100644 --- a/test/mocks/fs.js +++ b/test/mocks/fs.js @@ -2,9 +2,19 @@ import Model from '../../src/type/Model.js'; import lunr from 'lunr'; import sinon from 'sinon'; +/** + * @param filesystem + * @param models + * @return {{readFile: (*|void), writeFile: *, mkdir: *}} + */ function stubFs(filesystem = {}, models = []) { const modelsAddedToFilesystem = []; + /** + * @param initialFilesystem + * @param initialModels + * @return {object} + */ function fileSystemFromModels(initialFilesystem = {}, ...initialModels) { for (const model of initialModels) { const modelIndexPath = model.id.replace(/[A-Z0-9]+$/, '_index.json'); diff --git a/test/mocks/s3.js b/test/mocks/s3.js index 3fb385a..5676d33 100644 --- a/test/mocks/s3.js +++ b/test/mocks/s3.js @@ -3,6 +3,11 @@ import {NoSuchKey} from '@aws-sdk/client-s3'; import lunr from 'lunr'; import sinon from 'sinon'; +/** + * @param data + * @return {{Body: {transformToString: (function(): Promise>)}}} + * @constructor + */ function S3ObjectWrapper(data) { return { Body: { @@ -11,9 +16,19 @@ function S3ObjectWrapper(data) { }; } +/** + * @param filesystem + * @param models + * @return {{send: (*|void)}} + */ function stubS3Client(filesystem = {}, models = {}) { const modelsAddedToFilesystem = []; + /** + * @param initialFilesystem + * @param initialModels + * @return {object} + */ function bucketFilesFromModels(initialFilesystem = {}, ...initialModels) { for (const model of initialModels) { const modelIndexPath = model.id.replace(/[A-Z0-9]+$/, '_index.json');