Skip to content

Commit

Permalink
test: add more module jsdoc tests (#2412)
Browse files Browse the repository at this point in the history
  • Loading branch information
ST-DDT authored Sep 22, 2023
1 parent 005369b commit 7e274f3
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 2 deletions.
20 changes: 19 additions & 1 deletion test/scripts/apidoc/__snapshots__/module.spec.ts.snap
Original file line number Diff line number Diff line change
@@ -1,8 +1,16 @@
// Vitest Snapshot v1, https://vitest.dev/guide/snapshot.html

exports[`module > analyzeModule() > ModuleDeprecationTest 1`] = `
{
"comment": "This is a description for a module with a code example.",
"deprecated": "Well, this is deprecated.",
"examples": undefined,
}
`;

exports[`module > analyzeModule() > ModuleExampleTest 1`] = `
{
"comment": "This is a description for a module with a code example",
"comment": "This is a description for a module with a code example.",
"deprecated": undefined,
"examples": "<div class=\\"language-ts\\"><button title=\\"Copy Code\\" class=\\"copy\\"></button><span class=\\"lang\\">ts</span><pre v-pre class=\\"shiki material-theme-palenight\\"><code><span class=\\"line\\"><span style=\\"color:#89DDFF\\">new</span><span style=\\"color:#BABED8\\"> </span><span style=\\"color:#82AAFF\\">ModuleExampleTest</span><span style=\\"color:#BABED8\\">()</span></span></code></pre>
</div>",
Expand All @@ -27,10 +35,20 @@ and [api docs](/api/).",
}
`;

exports[`module > analyzeModule() > ModuleSimpleTest 1`] = `
{
"comment": "A simple module without anything special.",
"deprecated": undefined,
"examples": undefined,
}
`;

exports[`module > analyzeModule() > expected and actual modules are equal 1`] = `
[
"ModuleDeprecationTest",
"ModuleExampleTest",
"ModuleFakerJsLinkTest",
"ModuleNextFakerJsLinkTest",
"ModuleSimpleTest",
]
`;
14 changes: 13 additions & 1 deletion test/scripts/apidoc/module.example.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
/**
* A simple module without anything special.
*/
export class ModuleSimpleTest {}

/**
* Description with a link to our [website](https://fakerjs.dev/)
* and [api docs](https://fakerjs.dev/api/).
Expand All @@ -11,7 +16,14 @@ export class ModuleFakerJsLinkTest {}
export class ModuleNextFakerJsLinkTest {}

/**
* This is a description for a module with a code example
* This is a description for a module with a code example.
*
* @deprecated Well, this is deprecated.
*/
export class ModuleDeprecationTest {}

/**
* This is a description for a module with a code example.
*
* @example
* new ModuleExampleTest()
Expand Down

0 comments on commit 7e274f3

Please sign in to comment.