|
1 | 1 | import { join } from "path";
|
2 | 2 |
|
3 |
| -import { KNOWN_REGIONS } from "./fixtures"; |
| 3 | +import testCases from "./test_cases_supported.json"; |
4 | 4 |
|
5 |
| -describe("hostname for know regions", () => { |
6 |
| - for (const region of Object.keys(KNOWN_REGIONS)) { |
7 |
| - describe(region, () => { |
8 |
| - for (const [service, expectedHostname] of Object.entries(KNOWN_REGIONS[region])) { |
9 |
| - it(`${service} should resolve to hostname ${expectedHostname}`, async () => { |
10 |
| - const { defaultRegionInfoProvider } = await import( |
11 |
| - join("..", "..", "..", "clients", `client-${service}`, "src", "endpoints") |
12 |
| - ); |
13 |
| - const { hostname } = await defaultRegionInfoProvider(region); |
14 |
| - expect(hostname).toBe(expectedHostname); |
15 |
| - }); |
16 |
| - } |
| 5 | +const getClientPackageName = (sdkId: string) => |
| 6 | + `client-${sdkId |
| 7 | + .split(" ") |
| 8 | + .map((word) => word.toLowerCase()) |
| 9 | + .join("-")}`; |
| 10 | + |
| 11 | +describe("endpoints", () => { |
| 12 | + for (const { sdkId, region, useFipsEndpoint, useDualstackEndpoint, hostname } of testCases) { |
| 13 | + const clientPackageName = getClientPackageName(sdkId); |
| 14 | + it(`testing "${clientPackageName}" with region: ${region}`, async () => { |
| 15 | + const { defaultRegionInfoProvider } = await import( |
| 16 | + join("..", "..", "..", "clients", clientPackageName, "src", "endpoints") |
| 17 | + ); |
| 18 | + const regionInfo = await defaultRegionInfoProvider(region, { useFipsEndpoint, useDualstackEndpoint }); |
| 19 | + expect(regionInfo.hostname).toEqual(hostname); |
17 | 20 | });
|
18 | 21 | }
|
19 | 22 | });
|
0 commit comments