aboutsummaryrefslogtreecommitdiff
path: root/test/support
diff options
context:
space:
mode:
authorShinigami <[email protected]>2022-12-17 20:07:15 +0100
committerGitHub <[email protected]>2022-12-17 19:07:15 +0000
commit23c2d3dc1d311edc2c02373d575dc28db385bf1d (patch)
treeaeb068bf37ac7f23094881402f5822c235b69915 /test/support
parent0b2fa1ae96c6aabb7bcaae8d7f5f90df86d43786 (diff)
downloadfaker-23c2d3dc1d311edc2c02373d575dc28db385bf1d.tar.xz
faker-23c2d3dc1d311edc2c02373d575dc28db385bf1d.zip
test: fix duplicate test names (#1647)
Diffstat (limited to 'test/support')
-rw-r--r--test/support/seededRuns.ts10
1 files changed, 10 insertions, 0 deletions
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;
},