Skip to content

Commit

Permalink
chore: fix missing jsdoc blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
acodeninja committed Sep 30, 2024
1 parent 93d0119 commit 5df057b
Show file tree
Hide file tree
Showing 5 changed files with 49 additions and 0 deletions.
4 changes: 4 additions & 0 deletions test/assertions.js
Original file line number Diff line number Diff line change
@@ -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)) {
Expand Down
8 changes: 8 additions & 0 deletions test/mocks/engine.js
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {};
Expand All @@ -12,6 +16,10 @@ export function getTestEngine(models = []) {
_models[model.id] = _.cloneDeep(model);
}

/**
* @class TestEngine
* @extends Engine
*/
class TestEngine extends Engine {
}

Expand Down
12 changes: 12 additions & 0 deletions test/mocks/fetch.js
Original file line number Diff line number Diff line change
Expand Up @@ -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('/');
Expand Down
10 changes: 10 additions & 0 deletions test/mocks/fs.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
15 changes: 15 additions & 0 deletions test/mocks/s3.js
Original file line number Diff line number Diff line change
Expand Up @@ -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<Awaited<string>>)}}}
* @constructor
*/
function S3ObjectWrapper(data) {
return {
Body: {
Expand All @@ -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');
Expand Down

0 comments on commit 5df057b

Please sign in to comment.