diff options
| author | ST-DDT <[email protected]> | 2022-04-03 17:36:59 +0200 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-04-03 17:36:59 +0200 |
| commit | 6096cb4d5645f4af803b6f550ecb0f64d8942778 (patch) | |
| tree | 51030b6a4e1d9eb5dddf94403d9a8ce424072aba /test | |
| parent | 214a77b437aaff1282248a6ee14fd227d5e42c42 (diff) | |
| download | faker-6096cb4d5645f4af803b6f550ecb0f64d8942778.tar.xz faker-6096cb4d5645f4af803b6f550ecb0f64d8942778.zip | |
chore: deprecate name.title() in favor of name.jobTitle() (#766)
Diffstat (limited to 'test')
| -rw-r--r-- | test/name.spec.ts | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/test/name.spec.ts b/test/name.spec.ts index 40f34955..97ac7fba 100644 --- a/test/name.spec.ts +++ b/test/name.spec.ts @@ -519,6 +519,28 @@ describe('name', () => { faker.localeFallback = 'en'; }); + it('should display deprecated message', () => { + const spy = vi.spyOn(console, 'warn'); + + faker.name.title(); + + expect(spy).toHaveBeenCalledWith( + '[@faker-js/faker]: faker.name.title() is deprecated since v6.1.2 and will be removed in v7.0.0. Please use faker.name.jobTitle() instead.' + ); + + spy.mockRestore(); + }); + + it('should call jobTitle()', () => { + const spy = vi.spyOn(faker.name, 'jobTitle'); + + faker.name.title(); + + expect(spy).toHaveBeenCalledWith(); + + spy.mockRestore(); + }); + it('should return a title consisting of a descriptor, area, and type', () => { const title = faker.name.title(); @@ -526,7 +548,6 @@ describe('name', () => { const [descriptor, level, job] = title.split(' '); - // TODO @Shinigami92 2022-01-31: jobTitle and title are the same expect(faker.definitions.name.title.descriptor).toContain(descriptor); expect(faker.definitions.name.title.level).toContain(level); expect(faker.definitions.name.title.job).toContain(job); |
