diff options
| author | ST-DDT <[email protected]> | 2022-12-30 20:04:03 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-12-30 19:04:03 +0000 |
| commit | e296ff2d4f6f1aa56fe7c80722257bd0b316b30a (patch) | |
| tree | 199d89a678b7f7fd2623f1ebca48e5aa0616a80e /test/scripts | |
| parent | 7f7e4428893284efd2df49405e8c98e0eac4b190 (diff) | |
| download | faker-e296ff2d4f6f1aa56fe7c80722257bd0b316b30a.tar.xz faker-e296ff2d4f6f1aa56fe7c80722257bd0b316b30a.zip | |
docs: fix param check (#1694)
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.')) { |
