aboutsummaryrefslogtreecommitdiff
path: root/test/scripts
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2023-03-24 10:12:58 +0100
committerGitHub <[email protected]>2023-03-24 09:12:58 +0000
commit16383bbed55f3fdea8958f013f92f4fe9550d8cb (patch)
treebe880e7ae00e21bfd9775923dcebdbf830c83b0a /test/scripts
parent9dcf83f9b0b7353da6083da476d30dab74a52a50 (diff)
downloadfaker-16383bbed55f3fdea8958f013f92f4fe9550d8cb.tar.xz
faker-16383bbed55f3fdea8958f013f92f4fe9550d8cb.zip
docs: mark deprecated parameter options (#1962)
Diffstat (limited to 'test/scripts')
-rw-r--r--test/scripts/apidoc/__snapshots__/signature.spec.ts.snap62
-rw-r--r--test/scripts/apidoc/signature.example.ts29
2 files changed, 87 insertions, 4 deletions
diff --git a/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap b/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap
index e7add7c6..533d13da 100644
--- a/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap
+++ b/test/scripts/apidoc/__snapshots__/signature.spec.ts.snap
@@ -44,7 +44,7 @@ exports[`signature > analyzeSignature() > complexArrayParameter 1`] = `
"returns": "T",
"seeAlsos": [],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L301",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L330",
"title": "Complex Array Parameter",
}
`;
@@ -82,6 +82,7 @@ exports[`signature > analyzeSignature() > expected and actual methods are equal
"functionParamMethod",
"literalUnionParamMethod",
"methodWithDeprecated",
+ "methodWithDeprecatedOption",
"methodWithExample",
"methodWithMultipleSeeMarkers",
"methodWithMultipleSeeMarkersAndBackticks",
@@ -206,6 +207,59 @@ exports[`signature > analyzeSignature() > methodWithDeprecated 1`] = `
}
`;
+exports[`signature > analyzeSignature() > methodWithDeprecatedOption 1`] = `
+{
+ "deprecated": undefined,
+ "description": "<p>Test with deprecated option.</p>
+",
+ "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:#A6ACCD\\">faker</span><span style=\\"color:#89DDFF\\">.</span><span style=\\"color:#82AAFF\\">methodWithDeprecatedOption</span><span style=\\"color:#A6ACCD\\">(option: </span><span style=\\"color:#89DDFF\\">{</span></span>
+<span class=\\"line\\"><span style=\\"color:#A6ACCD\\"> </span><span style=\\"color:#F07178\\">a</span><span style=\\"color:#89DDFF\\">:</span><span style=\\"color:#A6ACCD\\"> string</span><span style=\\"color:#89DDFF\\">,</span></span>
+<span class=\\"line\\"><span style=\\"color:#A6ACCD\\"> </span><span style=\\"color:#82AAFF\\">b</span><span style=\\"color:#89DDFF\\">:</span><span style=\\"color:#A6ACCD\\"> </span><span style=\\"color:#89DDFF\\">()</span><span style=\\"color:#A6ACCD\\"> </span><span style=\\"color:#C792EA\\">=&gt;</span><span style=\\"color:#A6ACCD\\"> number</span><span style=\\"color:#89DDFF\\">,</span></span>
+<span class=\\"line\\"><span style=\\"color:#A6ACCD\\"> </span><span style=\\"color:#F07178\\">c</span><span style=\\"color:#89DDFF\\">:</span><span style=\\"color:#A6ACCD\\"> number</span></span>
+<span class=\\"line\\"><span style=\\"color:#89DDFF\\">}</span><span style=\\"color:#A6ACCD\\">): number</span></span>
+<span class=\\"line\\"></span></code></pre>
+</div>",
+ "name": "methodWithDeprecatedOption",
+ "parameters": [
+ {
+ "default": undefined,
+ "description": "<p>The options.</p>
+",
+ "name": "option",
+ "type": "{ ... }",
+ },
+ {
+ "default": undefined,
+ "description": "<p>Some deprecated option.</p>
+<p><strong>DEPRECATED:</strong> do something else.</p>
+",
+ "name": "option.a",
+ "type": "string",
+ },
+ {
+ "default": undefined,
+ "description": "<p>Some other deprecated option.</p>
+<p><strong>DEPRECATED:</strong> do something else.</p>
+",
+ "name": "option.b",
+ "type": "() => number",
+ },
+ {
+ "default": undefined,
+ "description": "<p>Some other option.</p>
+",
+ "name": "option.c",
+ "type": "number",
+ },
+ ],
+ "returns": "number",
+ "seeAlsos": [],
+ "since": "",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L272",
+ "title": "Method With Deprecated Option",
+}
+`;
+
exports[`signature > analyzeSignature() > methodWithExample 1`] = `
{
"deprecated": undefined,
@@ -241,7 +295,7 @@ exports[`signature > analyzeSignature() > methodWithMultipleSeeMarkers 1`] = `
"test.apidoc.methodWithDeprecated()",
],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L270",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L299",
"title": "Method With Multiple See Markers",
}
`;
@@ -262,7 +316,7 @@ exports[`signature > analyzeSignature() > methodWithMultipleSeeMarkersAndBacktic
"test.apidoc.methodWithDeprecated() with parameter <code>bar</code> and <code>baz</code>.",
],
"since": "",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L280",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L309",
"title": "Method With Multiple See Markers And Backticks",
}
`;
@@ -280,7 +334,7 @@ exports[`signature > analyzeSignature() > methodWithSinceMarker 1`] = `
"returns": "number",
"seeAlsos": [],
"since": "1.0.0",
- "sourcePath": "test/scripts/apidoc/signature.example.ts#L289",
+ "sourcePath": "test/scripts/apidoc/signature.example.ts#L318",
"title": "Method With Since Marker",
}
`;
diff --git a/test/scripts/apidoc/signature.example.ts b/test/scripts/apidoc/signature.example.ts
index 2d3010ae..1013365f 100644
--- a/test/scripts/apidoc/signature.example.ts
+++ b/test/scripts/apidoc/signature.example.ts
@@ -262,6 +262,35 @@ export class SignatureTest {
}
/**
+ * Test with deprecated option.
+ *
+ * @param option The options.
+ * @param option.a Some deprecated option.
+ * @param option.b Some other deprecated option.
+ * @param option.c Some other option.
+ */
+ methodWithDeprecatedOption(option: {
+ /**
+ * Some deprecated option.
+ *
+ * @deprecated do something else.
+ */
+ a: string;
+ /**
+ * Some other deprecated option.
+ *
+ * @deprecated do something else.
+ */
+ b: () => number;
+ /**
+ * Some other option.
+ */
+ c: number;
+ }): number {
+ return option.c;
+ }
+
+ /**
* Test with multiple see markers.
*
* @see test.apidoc.methodWithExample()