From e296ff2d4f6f1aa56fe7c80722257bd0b316b30a Mon Sep 17 00:00:00 2001 From: ST-DDT Date: Fri, 30 Dec 2022 20:04:03 +0100 Subject: docs: fix param check (#1694) --- .../scripts/apidoc/examplesAndDeprecations.spec.ts | 28 +++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'test/scripts') 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,8 +3,20 @@ 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, @@ -27,6 +39,8 @@ const locales: Record = { 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.')) { -- cgit v1.2.3