diff options
Diffstat (limited to 'test/scripts')
| -rw-r--r-- | test/scripts/apidoc/examplesAndDeprecations.spec.ts | 28 |
1 files changed, 27 insertions, 1 deletions
diff --git a/test/scripts/apidoc/examplesAndDeprecations.spec.ts b/test/scripts/apidoc/examplesAndDeprecations.spec.ts index 772307a9..df1769b4 100644 --- a/test/scripts/apidoc/examplesAndDeprecations.spec.ts +++ b/test/scripts/apidoc/examplesAndDeprecations.spec.ts @@ -3,9 +3,21 @@ import { resolve } from 'node:path'; import type { DeclarationReflection, SignatureReflection } from 'typedoc'; import { ReflectionKind } from 'typedoc'; import type { SpyInstance } from 'vitest'; -import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest'; +import { + afterAll, + beforeAll, + beforeEach, + describe, + expect, + it, + vi, +} from 'vitest'; import { selectApiModules } from '../../../scripts/apidoc/moduleMethods'; import { + analyzeSignature, + initMarkdownRenderer, +} from '../../../scripts/apidoc/signature'; +import { extractRawExamples, extractSeeAlsos, extractSince, @@ -27,6 +39,8 @@ const locales: Record<string, string> = { DE: 'de', }; +beforeAll(initMarkdownRenderer); + describe('examples and deprecations', () => { const project = loadProject(); @@ -107,6 +121,18 @@ describe('examples and deprecations', () => { } } + // Verify @param tags + analyzeSignature(signature, moduleName, methodName).parameters.forEach( + (param) => { + const { name, description } = param; + const plainDescription = description.replace(/<[^>]+>/g, '').trim(); + expect( + plainDescription, + `Expect param ${name} to have a description` + ).not.toBe('Missing'); + } + ); + // Verify @see tag extractSeeAlsos(signature).forEach((link) => { if (link.startsWith('faker.')) { |
