Skip to content

Commit df8ef52

Browse files
authored
test(functional): convert to TypeScript (#2930)
1 parent 5db4f3f commit df8ef52

File tree

9 files changed

+43
-41
lines changed

9 files changed

+43
-41
lines changed

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020
"build-documentation": "yarn remove-documentation && typedoc",
2121
"pretest:all": "yarn build:all",
2222
"test:all": "jest --coverage --passWithNoTests && lerna run test --scope '@aws-sdk/{fetch-http-handler,hash-blob-browser}'",
23-
"test:functional": "jest --config tests/functional/jest.config.js --passWithNoTests",
23+
"test:functional": "jest --config tests/functional/jest.config.js",
2424
"test:integration:legacy": "cucumber-js --fail-fast",
2525
"test:integration:legacy:since:release": "./tests/integ-legacy/index.js",
2626
"test:integration": "jest --config jest.config.integ.js --passWithNoTests",
@@ -129,4 +129,4 @@
129129
],
130130
"**/*.{ts,js,md,json}": "prettier --write"
131131
}
132-
}
132+
}

tests/functional/endpoints/fixtures.js renamed to tests/functional/endpoints/fixtures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
//reference: https://github.com/boto/botocore/blob/develop/tests/functional/test_regions.py
2-
module.exports.KNOWN_REGIONS = {
2+
export const KNOWN_REGIONS = {
33
"ap-northeast-1": {
44
"api-gateway": "apigateway.ap-northeast-1.amazonaws.com",
55
appstream: "appstream2.ap-northeast-1.amazonaws.com",

tests/functional/endpoints/index.spec.js

Lines changed: 0 additions & 16 deletions
This file was deleted.
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
import { join } from "path";
2+
3+
import { KNOWN_REGIONS } from "./fixtures";
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+
}
17+
});
18+
}
19+
});

tests/functional/jest.config.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
const base = require("../../jest.config.base");
2+
23
module.exports = {
34
...base,
4-
testMatch: ["./**/?(*.)+(spec|test).js?(x)"],
5+
testMatch: ["**/*.spec.ts"],
56
};

tests/functional/signing-names/fixtures.js renamed to tests/functional/signing-names/fixtures.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
module.exports.SIGNING_NAMES = {
1+
export const SIGNING_NAMES = {
22
"us-west-2": {
33
"rds-data": undefined,
44
},

tests/functional/signing-names/index.spec.js

Lines changed: 0 additions & 15 deletions
This file was deleted.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { join } from "path";
2+
3+
import { SIGNING_NAMES } from "./fixtures";
4+
5+
describe("signing names for know regions", () => {
6+
for (const region of Object.keys(SIGNING_NAMES)) {
7+
describe(region, () => {
8+
for (const [service, signingName] of Object.entries(SIGNING_NAMES[region])) {
9+
it(`${service} should infer signing name ${signingName}`, async () => {
10+
const { defaultRegionInfoProvider } = await import(
11+
join("..", "..", "..", "clients", `client-${service}`, "src", "endpoints")
12+
);
13+
expect(defaultRegionInfoProvider(region).signingService).toBe(signingName);
14+
});
15+
}
16+
});
17+
}
18+
});

tests/functional/util/regioninfo-provider.js

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)