Skip to content

Commit a6626de

Browse files
committed
test: migrate getV3ClientPackageName to node test runner
1 parent d99942f commit a6626de

File tree

1 file changed

+27
-20
lines changed

1 file changed

+27
-20
lines changed
Lines changed: 27 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,35 @@
1-
import { describe, expect, it } from "vitest";
1+
import { strictEqual, throws } from "node:assert";
2+
import { describe, it } from "node:test";
23

34
import { CLIENT_PACKAGE_NAMES_MAP } from "../config";
45
import { getV3ClientPackageName } from "./getV3ClientPackageName";
56

67
describe(getV3ClientPackageName.name, () => {
7-
it.each(Object.entries(CLIENT_PACKAGE_NAMES_MAP))(
8-
"getClientName('%s') === '%s'",
9-
(input, output) => {
10-
expect(getV3ClientPackageName(input)).toBe(`@aws-sdk/${output}`);
11-
}
12-
);
8+
for (const [input, output] of Object.entries(CLIENT_PACKAGE_NAMES_MAP)) {
9+
it("getClientName('%s') === '%s'", () => {
10+
strictEqual(getV3ClientPackageName(input), `@aws-sdk/${output}`);
11+
});
12+
}
1313

14-
it.each(["ImportExport", "MobileAnalytics", "SimpleDB"])(
15-
"throws for deprecated client '%s'",
16-
(deprecatedClient) => {
17-
expect(() => {
18-
getV3ClientPackageName(deprecatedClient);
19-
}).toThrow(new Error(`Client '${deprecatedClient}' is either deprecated or newly added.`));
20-
}
21-
);
14+
for (const deprecatedClient of ["ImportExport", "MobileAnalytics", "SimpleDB"]) {
15+
it("throws for deprecated client '%s'", () => {
16+
throws(
17+
() => {
18+
getV3ClientPackageName(deprecatedClient);
19+
},
20+
new Error(`Client '${deprecatedClient}' is either deprecated or newly added.`)
21+
);
22+
});
23+
}
2224

23-
it.each(["UNDEFINED", "NULL", "UNKNOWN"])("throws for unknown client '%s'", (unknownClient) => {
24-
expect(() => {
25-
getV3ClientPackageName(unknownClient);
26-
}).toThrow(new Error(`Client '${unknownClient}' is either deprecated or newly added.`));
27-
});
25+
for (const unknownClient of ["UNDEFINED", "NULL", "UNKNOWN"]) {
26+
it("throws for unknown client '%s'", () => {
27+
throws(
28+
() => {
29+
getV3ClientPackageName(unknownClient);
30+
},
31+
new Error(`Client '${unknownClient}' is either deprecated or newly added.`)
32+
);
33+
});
34+
}
2835
});

0 commit comments

Comments
 (0)