diff options
| author | Shinigami <[email protected]> | 2022-12-17 20:07:15 +0100 |
|---|---|---|
| committer | GitHub <[email protected]> | 2022-12-17 19:07:15 +0000 |
| commit | 23c2d3dc1d311edc2c02373d575dc28db385bf1d (patch) | |
| tree | aeb068bf37ac7f23094881402f5822c235b69915 /test | |
| parent | 0b2fa1ae96c6aabb7bcaae8d7f5f90df86d43786 (diff) | |
| download | faker-23c2d3dc1d311edc2c02373d575dc28db385bf1d.tar.xz faker-23c2d3dc1d311edc2c02373d575dc28db385bf1d.zip | |
test: fix duplicate test names (#1647)
Diffstat (limited to 'test')
| -rw-r--r-- | test/__snapshots__/helpers.spec.ts.snap | 6 | ||||
| -rw-r--r-- | test/__snapshots__/internet.spec.ts.snap | 36 | ||||
| -rw-r--r-- | test/helpers.spec.ts | 2 | ||||
| -rw-r--r-- | test/internet.spec.ts | 18 | ||||
| -rw-r--r-- | test/support/seededRuns.ts | 10 |
5 files changed, 24 insertions, 48 deletions
diff --git a/test/__snapshots__/helpers.spec.ts.snap b/test/__snapshots__/helpers.spec.ts.snap index ec47923b..06e0bc43 100644 --- a/test/__snapshots__/helpers.spec.ts.snap +++ b/test/__snapshots__/helpers.spec.ts.snap @@ -21,7 +21,7 @@ exports[`helpers > 42 > arrayElements > with array 1`] = ` ] `; -exports[`helpers > 42 > arrayElements > with array 2`] = ` +exports[`helpers > 42 > arrayElements > with array and count 1`] = ` [ "l", "r", @@ -200,7 +200,7 @@ exports[`helpers > 1211 > arrayElements > with array 1`] = ` ] `; -exports[`helpers > 1211 > arrayElements > with array 2`] = ` +exports[`helpers > 1211 > arrayElements > with array and count 1`] = ` [ "r", "o", @@ -375,7 +375,7 @@ exports[`helpers > 1337 > arrayElements > with array 1`] = ` ] `; -exports[`helpers > 1337 > arrayElements > with array 2`] = ` +exports[`helpers > 1337 > arrayElements > with array and count 1`] = ` [ "e", "W", diff --git a/test/__snapshots__/internet.spec.ts.snap b/test/__snapshots__/internet.spec.ts.snap index 206a15ee..2ad847d8 100644 --- a/test/__snapshots__/internet.spec.ts.snap +++ b/test/__snapshots__/internet.spec.ts.snap @@ -8,12 +8,6 @@ exports[`internet > 42 > color > with color base 1`] = `"#6298ac"`; exports[`internet > 42 > displayName > noArgs 1`] = `"Garnet.Schinner73"`; -exports[`internet > 42 > displayName > noArgs 2`] = `"Garnet.Schinner73"`; - -exports[`internet > 42 > displayName > noArgs 3`] = `"Garnet.Schinner73"`; - -exports[`internet > 42 > displayName > noArgs 4`] = `"Garnet.Schinner73"`; - exports[`internet > 42 > displayName > with Chinese names 1`] = `"大羽_陳"`; exports[`internet > 42 > displayName > with Cyrillic names 1`] = `"Фёдор_Достоевский"`; @@ -78,12 +72,6 @@ exports[`internet > 42 > userAgent 1`] = `"Mozilla/5.0 (Windows; U; Windows NT 6 exports[`internet > 42 > userName > noArgs 1`] = `"Garnet.Schinner73"`; -exports[`internet > 42 > userName > noArgs 2`] = `"Garnet.Schinner73"`; - -exports[`internet > 42 > userName > noArgs 3`] = `"Garnet.Schinner73"`; - -exports[`internet > 42 > userName > noArgs 4`] = `"Garnet.Schinner73"`; - exports[`internet > 42 > userName > with Chinese names 1`] = `"hlzp8d_tpv"`; exports[`internet > 42 > userName > with Cyrillic names 1`] = `"Fedor_Dostoevskii"`; @@ -100,12 +88,6 @@ exports[`internet > 1211 > color > with color base 1`] = `"#a96ca4"`; exports[`internet > 1211 > displayName > noArgs 1`] = `"Tito_Koelpin22"`; -exports[`internet > 1211 > displayName > noArgs 2`] = `"Tito_Koelpin22"`; - -exports[`internet > 1211 > displayName > noArgs 3`] = `"Tito_Koelpin22"`; - -exports[`internet > 1211 > displayName > noArgs 4`] = `"Tito_Koelpin22"`; - exports[`internet > 1211 > displayName > with Chinese names 1`] = `"大羽.陳89"`; exports[`internet > 1211 > displayName > with Cyrillic names 1`] = `"Фёдор.Достоевский89"`; @@ -170,12 +152,6 @@ exports[`internet > 1211 > userAgent 1`] = `"Mozilla/5.0 (Macintosh; U; Intel Ma exports[`internet > 1211 > userName > noArgs 1`] = `"Tito_Koelpin22"`; -exports[`internet > 1211 > userName > noArgs 2`] = `"Tito_Koelpin22"`; - -exports[`internet > 1211 > userName > noArgs 3`] = `"Tito_Koelpin22"`; - -exports[`internet > 1211 > userName > noArgs 4`] = `"Tito_Koelpin22"`; - exports[`internet > 1211 > userName > with Chinese names 1`] = `"hlzp8d.tpv89"`; exports[`internet > 1211 > userName > with Cyrillic names 1`] = `"Fedor.Dostoevskii89"`; @@ -192,12 +168,6 @@ exports[`internet > 1337 > color > with color base 1`] = `"#537a46"`; exports[`internet > 1337 > displayName > noArgs 1`] = `"Devyn21"`; -exports[`internet > 1337 > displayName > noArgs 2`] = `"Devyn21"`; - -exports[`internet > 1337 > displayName > noArgs 3`] = `"Devyn21"`; - -exports[`internet > 1337 > displayName > noArgs 4`] = `"Devyn21"`; - exports[`internet > 1337 > displayName > with Chinese names 1`] = `"大羽56"`; exports[`internet > 1337 > displayName > with Cyrillic names 1`] = `"Фёдор56"`; @@ -262,12 +232,6 @@ exports[`internet > 1337 > userAgent 1`] = `"Mozilla/5.0 (Windows; U; Windows NT exports[`internet > 1337 > userName > noArgs 1`] = `"Devyn21"`; -exports[`internet > 1337 > userName > noArgs 2`] = `"Devyn21"`; - -exports[`internet > 1337 > userName > noArgs 3`] = `"Devyn21"`; - -exports[`internet > 1337 > userName > noArgs 4`] = `"Devyn21"`; - exports[`internet > 1337 > userName > with Chinese names 1`] = `"hlzp8d56"`; exports[`internet > 1337 > userName > with Cyrillic names 1`] = `"Fedor56"`; diff --git a/test/helpers.spec.ts b/test/helpers.spec.ts index 24a8d6da..5829ddd8 100644 --- a/test/helpers.spec.ts +++ b/test/helpers.spec.ts @@ -62,7 +62,7 @@ describe('helpers', () => { t.describe('arrayElements', (t) => { t.it('noArgs') .it('with array', 'Hello World!'.split('')) - .it('with array', 'Hello World!'.split(''), 3); + .it('with array and count', 'Hello World!'.split(''), 3); }); t.describe('shuffle', (t) => { diff --git a/test/internet.spec.ts b/test/internet.spec.ts index 45ed1963..11cbb60e 100644 --- a/test/internet.spec.ts +++ b/test/internet.spec.ts @@ -38,17 +38,19 @@ describe('internet', () => { }); t.describe('userName', (t) => { - t.it('noArgs').it('with Latin names', 'Jane', 'Doe'); - t.it('noArgs').it('with accented names', 'Hélene', 'Müller'); - t.it('noArgs').it('with Cyrillic names', 'Фёдор', 'Достоевский'); - t.it('noArgs').it('with Chinese names', '大羽', '陳'); + t.it('noArgs') + .it('with Latin names', 'Jane', 'Doe') + .it('with accented names', 'Hélene', 'Müller') + .it('with Cyrillic names', 'Фёдор', 'Достоевский') + .it('with Chinese names', '大羽', '陳'); }); t.describe('displayName', (t) => { - t.it('noArgs').it('with Latin names', 'Jane', 'Doe'); - t.it('noArgs').it('with accented names', 'Hélene', 'Müller'); - t.it('noArgs').it('with Cyrillic names', 'Фёдор', 'Достоевский'); - t.it('noArgs').it('with Chinese names', '大羽', '陳'); + t.it('noArgs') + .it('with Latin names', 'Jane', 'Doe') + .it('with accented names', 'Hélene', 'Müller') + .it('with Cyrillic names', 'Фёдор', 'Достоевский') + .it('with Chinese names', '大羽', '陳'); }); t.describe('password', (t) => { diff --git a/test/support/seededRuns.ts b/test/support/seededRuns.ts index be61cfad..aa6d5a9b 100644 --- a/test/support/seededRuns.ts +++ b/test/support/seededRuns.ts @@ -236,8 +236,17 @@ class TestGenerator< this.expectNotTested(method); const callAndVerify: TestGenerator<ModuleName, Module>['callAndVerify'] = this.callAndVerify.bind(this); + const variantNames = new Set<string>(); + const expectVariantNotTested = (name: string): void => { + expect( + variantNames.has(name), + `${name} test to be unique for ${method}` + ).toBeFalsy(); + variantNames.add(name); + }; const tester: MethodTester<Module[MethodName]> = { it(name: string, ...args: Parameters<Module[MethodName]>) { + expectVariantNotTested(name); vi_it(name, () => callAndVerify(method, args)); return tester; }, @@ -246,6 +255,7 @@ class TestGenerator< repetitions: number, ...args: Parameters<Module[MethodName]> ) { + expectVariantNotTested(name); vi_it(name, () => callAndVerify(method, args, repetitions)); return tester; }, |
