Skip to content

Commit 96279e3

Browse files
committed
feat: add unit test for deprecated methods in helper
1 parent 6502fc5 commit 96279e3

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

test/helpers.spec.ts

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { afterEach, describe, expect, it } from 'vitest';
1+
import { afterEach, describe, expect, it, vi } from 'vitest';
22
import { faker } from '../src';
33
import { luhnCheck } from './support/luhnCheck';
44

@@ -766,4 +766,19 @@ describe('helpers', () => {
766766
});
767767
}
768768
});
769+
describe('deprecation warnings', () => {
770+
it.each(['createCard', 'contextualCard', 'userCard'])(
771+
'should warn user that function random.%s is deprecated',
772+
(functionName) => {
773+
const spy = vi.spyOn(console, 'warn');
774+
775+
faker.helpers[functionName]();
776+
777+
expect(spy).toHaveBeenCalledWith(
778+
`Deprecation Warning: If you need some specific object you should create your own method.`
779+
);
780+
spy.mockRestore();
781+
}
782+
);
783+
});
769784
});

0 commit comments

Comments
 (0)