Skip to content

Commit

Permalink
apply partial suggestions
Browse files Browse the repository at this point in the history
  • Loading branch information
Shinigami92 committed Mar 28, 2023
1 parent 9c8325e commit 7b09756
Showing 1 changed file with 16 additions and 11 deletions.
27 changes: 16 additions & 11 deletions test/scripts/apidoc/verify-jsdoc-tags.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import { mkdirSync, rmdirSync, writeFileSync } from 'node:fs';
import { resolve } from 'node:path';
import validator from 'validator';
import { afterAll, beforeAll, describe, expect, it, vi } from 'vitest';
import {
analyzeSignature,
Expand All @@ -14,30 +15,30 @@ import {
} from '../../../scripts/apidoc/typedoc';
import { loadProjectModules } from './utils';

/*
* This test ensures, that every method
* - has working examples
* - and running these do not log anything, unless the method is deprecated
*/
// This test ensures, that every method
// - has working examples
// - running these do not log anything, unless the method is deprecated

beforeAll(initMarkdownRenderer);

const tempDir = resolve(__dirname, 'temp');

afterAll(() => {
// Remove temp folder

const tempDir = resolve(__dirname, 'temp');

rmdirSync(tempDir, { recursive: true });
});

describe('verify JSDoc tags', () => {
const modules = loadProjectModules();

function resolveDirToModule(moduleName: string): string {
return resolve(__dirname, 'temp', moduleName);
return resolve(tempDir, moduleName);
}

function resolvePathToMethodFile(moduleName: string, methodName: string) {
function resolvePathToMethodFile(
moduleName: string,
methodName: string
): string {
const dir = resolveDirToModule(moduleName);
return resolve(dir, `${methodName}.ts`);
}
Expand Down Expand Up @@ -136,7 +137,11 @@ describe('verify JSDoc tags', () => {
});

it('verify @since tag', () => {
expect(extractSince(signature), '@since to be present').toBeTruthy();
const since = extractSince(signature);
expect(since, '@since to be present').toBeTruthy();
expect(since, '@since to be a valid semver').toSatisfy(
validator.isSemVer
);
});
}
);
Expand Down

0 comments on commit 7b09756

Please sign in to comment.