Skip to content

Commit 1b43983

Browse files
committed
fix linting issues
1 parent e896755 commit 1b43983

File tree

9 files changed

+81
-69
lines changed

9 files changed

+81
-69
lines changed

.eslintrc.js

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ module.exports = {
1111
"import/no-extraneous-dependencies" : "off"
1212
},
1313
"env": {
14-
"mocha": true
14+
"mocha": true,
15+
"jest": true
1516
}
1617
};

tests/integration/aws/api-gateway/integration-lambda-proxy/api-keys/tests.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -67,13 +67,14 @@ it('should reject a request with an invalid API Key', () => fetch(endpoint)
6767
})
6868
);
6969

70-
it('should succeed if correct API key is given', () => fetch(endpoint, { headers: { 'x-api-key': apiKey } })
71-
.then(response => response.json())
72-
.then((json) => {
73-
expect(json.message).to.equal('Hello from API Gateway!');
74-
expect(json.event.requestContext.identity.apiKey).to.equal(apiKey);
75-
expect(json.event.headers['x-api-key']).to.equal(apiKey);
76-
})
70+
it('should succeed if correct API key is given', () =>
71+
fetch(endpoint, { headers: { 'x-api-key': apiKey } })
72+
.then(response => response.json())
73+
.then((json) => {
74+
expect(json.message).to.equal('Hello from API Gateway!');
75+
expect(json.event.requestContext.identity.apiKey).to.equal(apiKey);
76+
expect(json.event.headers['x-api-key']).to.equal(apiKey);
77+
})
7778
);
7879

7980
afterAll(() => {

tests/integration/aws/api-gateway/integration-lambda-proxy/cors/tests.js

+10-9
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,16 @@ beforeAll(() => fetch(`${endpointBase}/simple-cors`, { method: 'OPTIONS' })
4444
})
4545
);
4646

47-
it('should setup CORS support with complex object config', () => fetch(`${endpointBase}/complex-cors`, { method: 'OPTIONS' })
48-
.then((response) => {
49-
const headers = response.headers;
50-
51-
expect(headers.get('access-control-allow-headers'))
52-
.to.equal('Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token');
53-
expect(headers.get('access-control-allow-methods')).to.equal('OPTIONS,GET');
54-
expect(headers.get('access-control-allow-origin')).to.equal('*');
55-
})
47+
it('should setup CORS support with complex object config', () =>
48+
fetch(`${endpointBase}/complex-cors`, { method: 'OPTIONS' })
49+
.then((response) => {
50+
const headers = response.headers;
51+
52+
expect(headers.get('access-control-allow-headers'))
53+
.to.equal('Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token');
54+
expect(headers.get('access-control-allow-methods')).to.equal('OPTIONS,GET');
55+
expect(headers.get('access-control-allow-origin')).to.equal('*');
56+
})
5657
);
5758

5859
afterAll(() => {

tests/integration/aws/api-gateway/integration-lambda-proxy/custom-authorizers/tests.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -39,19 +39,21 @@ it('should reject requests without authorization', () => fetch(endpoint)
3939
})
4040
);
4141

42-
it('should reject requests with wrong authorization', () => fetch(endpoint, { headers: { Authorization: 'Bearer ShouldNotBeAuthorized' } })
43-
.then((response) => {
44-
expect(response.status).to.equal(401);
45-
})
42+
it('should reject requests with wrong authorization', () =>
43+
fetch(endpoint, { headers: { Authorization: 'Bearer ShouldNotBeAuthorized' } })
44+
.then((response) => {
45+
expect(response.status).to.equal(401);
46+
})
4647
);
4748

48-
it('should authorize requests with correct authorization', () => fetch(endpoint, { headers: { Authorization: 'Bearer ShouldBeAuthorized' } })
49-
.then(response => response.json())
50-
.then((json) => {
51-
expect(json.message).to.equal('Successfully authorized!');
52-
expect(json.event.requestContext.authorizer.principalId).to.equal('SomeRandomId');
53-
expect(json.event.headers.Authorization).to.equal('Bearer ShouldBeAuthorized');
54-
})
49+
it('should authorize requests with correct authorization', () =>
50+
fetch(endpoint, { headers: { Authorization: 'Bearer ShouldBeAuthorized' } })
51+
.then(response => response.json())
52+
.then((json) => {
53+
expect(json.message).to.equal('Successfully authorized!');
54+
expect(json.event.requestContext.authorizer.principalId).to.equal('SomeRandomId');
55+
expect(json.event.headers.Authorization).to.equal('Bearer ShouldBeAuthorized');
56+
})
5557
);
5658

5759
afterAll(() => {

tests/integration/aws/api-gateway/integration-lambda/api-keys/tests.js

+8-7
Original file line numberDiff line numberDiff line change
@@ -70,13 +70,14 @@ it('should reject a request with an invalid API Key', () => fetch(endpoint)
7070
})
7171
);
7272

73-
it('should succeed if correct API key is given', () => fetch(endpoint, { headers: { 'x-api-key': apiKey } })
74-
.then(response => response.json())
75-
.then((json) => {
76-
expect(json.message).to.equal('Hello from API Gateway!');
77-
expect(json.event.identity.apiKey).to.equal(apiKey);
78-
expect(json.event.headers['x-api-key']).to.equal(apiKey);
79-
})
73+
it('should succeed if correct API key is given', () =>
74+
fetch(endpoint, { headers: { 'x-api-key': apiKey } })
75+
.then(response => response.json())
76+
.then((json) => {
77+
expect(json.message).to.equal('Hello from API Gateway!');
78+
expect(json.event.identity.apiKey).to.equal(apiKey);
79+
expect(json.event.headers['x-api-key']).to.equal(apiKey);
80+
})
8081
);
8182

8283
afterAll(() => {

tests/integration/aws/api-gateway/integration-lambda/cors/tests.js

+19-17
Original file line numberDiff line numberDiff line change
@@ -30,26 +30,28 @@ beforeAll(() => CF.describeStacksPromised({ StackName: stackName })
3030
})
3131
);
3232

33-
it('should setup CORS support with simple string config', () => fetch(`${endpointBase}/simple-cors`, { method: 'OPTIONS' })
34-
.then((response) => {
35-
const headers = response.headers;
36-
37-
expect(headers.get('access-control-allow-headers'))
38-
.to.equal('Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token');
39-
expect(headers.get('access-control-allow-methods')).to.equal('OPTIONS,GET');
40-
expect(headers.get('access-control-allow-origin')).to.equal('*');
41-
})
33+
it('should setup CORS support with simple string config', () =>
34+
fetch(`${endpointBase}/simple-cors`, { method: 'OPTIONS' })
35+
.then((response) => {
36+
const headers = response.headers;
37+
38+
expect(headers.get('access-control-allow-headers'))
39+
.to.equal('Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token');
40+
expect(headers.get('access-control-allow-methods')).to.equal('OPTIONS,GET');
41+
expect(headers.get('access-control-allow-origin')).to.equal('*');
42+
})
4243
);
4344

44-
it('should setup CORS support with complex object config', () => fetch(`${endpointBase}/complex-cors`, { method: 'OPTIONS' })
45-
.then((response) => {
46-
const headers = response.headers;
45+
it('should setup CORS support with complex object config', () =>
46+
fetch(`${endpointBase}/complex-cors`, { method: 'OPTIONS' })
47+
.then((response) => {
48+
const headers = response.headers;
4749

48-
expect(headers.get('access-control-allow-headers'))
49-
.to.equal('Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token');
50-
expect(headers.get('access-control-allow-methods')).to.equal('OPTIONS,GET');
51-
expect(headers.get('access-control-allow-origin')).to.equal('*');
52-
})
50+
expect(headers.get('access-control-allow-headers'))
51+
.to.equal('Content-Type,X-Amz-Date,Authorization,X-Api-Key,X-Amz-Security-Token');
52+
expect(headers.get('access-control-allow-methods')).to.equal('OPTIONS,GET');
53+
expect(headers.get('access-control-allow-origin')).to.equal('*');
54+
})
5355
);
5456

5557
afterAll(() => {

tests/integration/aws/api-gateway/integration-lambda/custom-authorizers/tests.js

+13-11
Original file line numberDiff line numberDiff line change
@@ -37,19 +37,21 @@ it('should reject requests without authorization', () => fetch(endpoint)
3737
})
3838
);
3939

40-
it('should reject requests with wrong authorization', () => fetch(endpoint, { headers: { Authorization: 'Bearer ShouldNotBeAuthorized' } })
41-
.then((response) => {
42-
expect(response.status).to.equal(401);
43-
})
40+
it('should reject requests with wrong authorization', () =>
41+
fetch(endpoint, { headers: { Authorization: 'Bearer ShouldNotBeAuthorized' } })
42+
.then((response) => {
43+
expect(response.status).to.equal(401);
44+
})
4445
);
4546

46-
it('should authorize requests with correct authorization', () => fetch(endpoint, { headers: { Authorization: 'Bearer ShouldBeAuthorized' } })
47-
.then(response => response.json())
48-
.then((json) => {
49-
expect(json.message).to.equal('Successfully authorized!');
50-
expect(json.event.principalId).to.equal('SomeRandomId');
51-
expect(json.event.headers.Authorization).to.equal('Bearer ShouldBeAuthorized');
52-
})
47+
it('should authorize requests with correct authorization', () =>
48+
fetch(endpoint, { headers: { Authorization: 'Bearer ShouldBeAuthorized' } })
49+
.then(response => response.json())
50+
.then((json) => {
51+
expect(json.message).to.equal('Successfully authorized!');
52+
expect(json.event.principalId).to.equal('SomeRandomId');
53+
expect(json.event.headers.Authorization).to.equal('Bearer ShouldBeAuthorized');
54+
})
5355
);
5456

5557
afterAll(() => {

tests/integration/aws/general/custom-resources/tests.js

+7-6
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,13 @@ beforeAll(() => {
3636
Utils.deployService();
3737
});
3838

39-
it('should add the custom outputs to the Outputs section', () => CF.describeStacksPromised({ StackName: stackName })
40-
.then((result) => _.find(result.Stacks[0].Outputs,
41-
{ OutputKey: 'MyCustomOutput' }).OutputValue)
42-
.then((endpointOutput) => {
43-
expect(endpointOutput).to.equal('SomeValue');
44-
})
39+
it('should add the custom outputs to the Outputs section', () =>
40+
CF.describeStacksPromised({ StackName: stackName })
41+
.then((result) => _.find(result.Stacks[0].Outputs,
42+
{ OutputKey: 'MyCustomOutput' }).OutputValue)
43+
.then((endpointOutput) => {
44+
expect(endpointOutput).to.equal('SomeValue');
45+
})
4546
);
4647

4748
it('should create the custom resources (a S3 bucket)', () => S3.listBucketsPromised()

tests/setupTests.js

+1
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
11
// timeout is set to 5 minutes
2+
// eslint-disable-next-line no-undef
23
jasmine.DEFAULT_TIMEOUT_INTERVAL = 300000;

0 commit comments

Comments
 (0)