aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorST-DDT <[email protected]>2022-07-30 23:07:09 +0200
committerGitHub <[email protected]>2022-07-30 23:07:09 +0200
commit5589a3c4b69a77f4053e38fb7cef5f6c963fea4f (patch)
tree8b4991eb7173feead58ea539d1fdc366367e5963
parentef6fbacfb15225b0f12fb5f6e6f382a0c3ed9915 (diff)
downloadfaker-5589a3c4b69a77f4053e38fb7cef5f6c963fea4f.tar.xz
faker-5589a3c4b69a77f4053e38fb7cef5f6c963fea4f.zip
test: ensure jsdoc deprecated tag to have a message (#1213)
-rw-r--r--src/modules/phone/index.ts2
-rw-r--r--test/scripts/apidoc/examplesAndDeprecations.spec.ts5
2 files changed, 6 insertions, 1 deletions
diff --git a/src/modules/phone/index.ts b/src/modules/phone/index.ts
index 08da0821..7e071b61 100644
--- a/src/modules/phone/index.ts
+++ b/src/modules/phone/index.ts
@@ -27,7 +27,7 @@ export class Phone {
* faker.phone.phoneNumber('501-###-###') // '501-039-841'
* faker.phone.phoneNumber('+48 91 ### ## ##') // '+48 91 463 61 70'
*
- * @deprecated
+ * @deprecated Use faker.phone.number() instead.
*/
phoneNumber(format?: string): string {
deprecated({
diff --git a/test/scripts/apidoc/examplesAndDeprecations.spec.ts b/test/scripts/apidoc/examplesAndDeprecations.spec.ts
index 314e72d4..9eb10d39 100644
--- a/test/scripts/apidoc/examplesAndDeprecations.spec.ts
+++ b/test/scripts/apidoc/examplesAndDeprecations.spec.ts
@@ -6,6 +6,7 @@ import type { SpyInstance } from 'vitest';
import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest';
import {
extractRawExamples,
+ extractTagContent,
isDeprecated,
} from '../../../scripts/apidoc/utils';
import { faker } from '../../../src';
@@ -101,6 +102,10 @@ describe('examples and deprecations', () => {
const deprecatedFlag = isDeprecated(signature);
if (deprecatedFlag) {
expect(consoleSpies[1]).toHaveBeenCalled();
+ expect(
+ extractTagContent('@deprecated', signature).join(''),
+ '@deprecated tag without message'
+ ).not.toBe('');
} else {
for (const spy of consoleSpies) {
expect(spy).not.toHaveBeenCalled();