Skip to content

Commit 5589a3c

Browse files
authored
test: ensure jsdoc deprecated tag to have a message (#1213)
1 parent ef6fbac commit 5589a3c

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/modules/phone/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ export class Phone {
2727
* faker.phone.phoneNumber('501-###-###') // '501-039-841'
2828
* faker.phone.phoneNumber('+48 91 ### ## ##') // '+48 91 463 61 70'
2929
*
30-
* @deprecated
30+
* @deprecated Use faker.phone.number() instead.
3131
*/
3232
phoneNumber(format?: string): string {
3333
deprecated({

test/scripts/apidoc/examplesAndDeprecations.spec.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import type { SpyInstance } from 'vitest';
66
import { afterAll, beforeEach, describe, expect, it, vi } from 'vitest';
77
import {
88
extractRawExamples,
9+
extractTagContent,
910
isDeprecated,
1011
} from '../../../scripts/apidoc/utils';
1112
import { faker } from '../../../src';
@@ -101,6 +102,10 @@ describe('examples and deprecations', () => {
101102
const deprecatedFlag = isDeprecated(signature);
102103
if (deprecatedFlag) {
103104
expect(consoleSpies[1]).toHaveBeenCalled();
105+
expect(
106+
extractTagContent('@deprecated', signature).join(''),
107+
'@deprecated tag without message'
108+
).not.toBe('');
104109
} else {
105110
for (const spy of consoleSpies) {
106111
expect(spy).not.toHaveBeenCalled();

0 commit comments

Comments
 (0)