Skip to content

test: ensure jsdoc deprecated tag to have a message #1213

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 30, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/modules/phone/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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({
Expand Down
5 changes: 5 additions & 0 deletions test/scripts/apidoc/examplesAndDeprecations.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Expand Down Expand Up @@ -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();
Expand Down