Skip to content

Commit c4610d2

Browse files
committed
make test easier to read/maintain
1 parent fdd8c15 commit c4610d2

File tree

1 file changed

+6
-11
lines changed

1 file changed

+6
-11
lines changed

test/version.test.js

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -35,19 +35,14 @@ describe("Test versions", function() {
3535
})
3636
).toThrow(new Error("Bad version number : x.y.z"));
3737
});
38-
it("unhandled version", function() {
38+
it.each([
39+
["unhandled version 4.9", "4.9"],
40+
["unhandled version 8.9", "8.9"],
41+
["unhandled version -0.9", "-0.9"]
42+
])("%s", function(_, version) {
3943
expect(
4044
parser.create.bind(null, {
41-
parser: {
42-
version: "4.9"
43-
}
44-
})
45-
).toThrow(new Error("Can only handle versions between 5.x to 7.x"));
46-
expect(
47-
parser.create.bind(null, {
48-
parser: {
49-
version: "8.9"
50-
}
45+
parser: { version }
5146
})
5247
).toThrow(new Error("Can only handle versions between 5.x to 7.x"));
5348
});

0 commit comments

Comments
 (0)