From acca1f074c25d04575f9df1a363d982b2035d71a Mon Sep 17 00:00:00 2001 From: Mohamed Shams El-Deen Date: Wed, 12 Aug 2026 20:10:53 +0300 Subject: [PATCH] test(theme): expand test fixtures to cover default TypeDoc reflections --- tests/theme/fixtures/input.js | 60 ++++++++++++++++++- tests/theme/theme.test.mjs | 4 +- tests/theme/theme.test.mjs.snapshot | 90 +++++++++++++++++++++++++++++ 3 files changed, 150 insertions(+), 4 deletions(-) diff --git a/tests/theme/fixtures/input.js b/tests/theme/fixtures/input.js index e221b5bd..a8b922f9 100644 --- a/tests/theme/fixtures/input.js +++ b/tests/theme/fixtures/input.js @@ -127,10 +127,10 @@ export class TypedListTest extends WebpackTest { */ /** - * Variable demonstrating declarationTitle formatting. + * A standalone constant demonstrating declarationTitle formatting and variable rendering. * @type {string} */ -export const declarationTitleTest = 'pass me'; +export const CONSTANT_AND_DECLARATION_TITLE_TEST = 'pass me'; /** * Class demonstrating indexSignature rendering. @@ -160,3 +160,59 @@ export class MemberGroupsTest { */ init() {} } + +/** + * A simple enum demonstrating enum rendering. + * @enum {number} + */ +export const EnumTest = { + /** The first option */ + ONE: 1, + /** The second option */ + TWO: 2, +}; + +/** + * A standalone function demonstrating generics outside a class. + * @template T + * @param {T} value The input value + * @returns {T} The same value + */ +export function standAloneWithGenericsTest(value) { + return value; +} + +/** + * Class demonstrating Getters and Setters (Accessors). + */ +export class AccessorTest { + /** + * Gets the current configuration name. + * @returns {string} + */ + get configName() { + return ''; + } + + /** + * Sets the configuration name. + * @param {string} val The new name + */ + set configName(val) {} +} + +/** + * A namespace demonstrating nested members. + * @namespace + */ +export const WebpackUtils = { + /** + * Merges two configurations. + * @param {object} a First config + * @param {object} b Second config + * @returns {object} Merged config + */ + merge(a, b) { + return Object.assign({}, a, b); + }, +}; diff --git a/tests/theme/theme.test.mjs b/tests/theme/theme.test.mjs index 14cd852e..93e67bef 100644 --- a/tests/theme/theme.test.mjs +++ b/tests/theme/theme.test.mjs @@ -27,8 +27,8 @@ test('TypeDoc Theme - Edge Cases Fixture', async t => { const project = await app.convert(); await app.generateOutputs(project); - const mdFiles = readdirSync(outputDir, { recursive: true }).filter( - f => f.endsWith('.md') && !f.endsWith('index.md') + const mdFiles = readdirSync(outputDir, { recursive: true }).filter(f => + f.endsWith('.md') ); if (mdFiles.length === 0) throw new Error('No markdown file generated'); diff --git a/tests/theme/theme.test.mjs.snapshot b/tests/theme/theme.test.mjs.snapshot index 44a9c143..36b5744c 100644 --- a/tests/theme/theme.test.mjs.snapshot +++ b/tests/theme/theme.test.mjs.snapshot @@ -1,4 +1,36 @@ exports[`TypeDoc Theme - Edge Cases Fixture 1`] = ` +# Class: \`webpack.js.org.AccessorTest\` + +Class demonstrating Getters and Setters (Accessors). + +## Constructors + +### \`new AccessorTest()\` + +* Returns: {AccessorTest} + +## Properties + +* \`configName\` {string} Gets the current configuration name. + + +--- + +# \`webpack.js.org.EnumTest\` + +## \`ONE\` + +* Type: {number} + +*** + +## \`TWO\` + +* Type: {number} + + +--- + # Class: \`webpack.js.org.ExamplesTest\` Class demonstrating the formatting of JSDoc example blocks. @@ -207,6 +239,56 @@ Class demonstrating Webpack as a parent class. * Returns: {WebpackTest} +--- + +# \`webpack.js.org.WebpackUtils\` + +## \`merge(a, b)\` + +* \`a\` {object} First config +* \`b\` {object} Second config +* Returns: {object} Merged config + +Merges two configurations. + + +--- + +# \`webpack.js.org\` + +## Namespaces + +- [EnumTest](/EnumTest.md) +- [WebpackUtils](/WebpackUtils.md) + +## Classes + +- [AccessorTest](/AccessorTest.md) +- [ExamplesTest](/ExamplesTest.md) +- [IndexSignatureTest](/IndexSignatureTest.md) +- [MemberGroupsTest](/MemberGroupsTest.md) +- [OverloadTest](/OverloadTest.md) +- [StabilityTest](/StabilityTest.md) +- [TypedListTest](/TypedListTest.md) +- [WebpackInterface](/WebpackInterface.md) +- [WebpackTest](/WebpackTest.md) + +## \`webpack.js.org.CONSTANT_AND_DECLARATION_TITLE_TEST\` + +* Type: {string} + +A standalone constant demonstrating declarationTitle formatting and variable rendering. + +*** + +## \`webpack.js.org.standAloneWithGenericsTest(value)\` + +* \`value\` {T} The input value +* Returns: {T} The same value + +A standalone function demonstrating generics outside a class. + + --- # \`webpack\` Types @@ -250,6 +332,14 @@ Complex union type. *** +## Type: \`EnumTest\` + +* Type: {number} + +A simple enum demonstrating enum rendering. + +*** + ## Type: \`SimpleArrayType\` * Type: {string[]}