forked from aws/aws-sdk-js
/
index.spec.js
41 lines (35 loc) · 933 Bytes
/
index.spec.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
const testCases = require('./test_cases_supported.json');
const helpers = require('../helpers');
const AWS = helpers.AWS;
describe('endpoints', () => {
beforeEach(function () {
helpers.mockResponse({
data: {},
});
});
for (const {
clientName,
region,
useFipsEndpoint,
useDualstackEndpoint,
hostname,
} of testCases) {
it(`testing "${clientName}" with region: ${region}`, (done) => {
if (!AWS[clientName]) {
throw new Error(`${clientName} does not exist`);
}
const client = new AWS[clientName]({
region,
useFipsEndpoint,
useDualstackEndpoint,
hostPrefixEnabled: false
});
const req = client[Object.keys(client.api.operations)[0]]();
req.on('complete', function () {
expect(hostname).to.equal(req.httpRequest.endpoint.host);
done();
});
req.send(function () {});
});
}
});