Skip to content

Commit 769300b

Browse files
Fix linting issues
1 parent f272ddf commit 769300b

File tree

2 files changed

+50
-38
lines changed

2 files changed

+50
-38
lines changed

lib/deploy/events/apiGateway/methods.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ module.exports = {
6666
],
6767
},
6868
PassthroughBehavior: 'NEVER',
69-
RequestTemplates: this.getIntegrationRequestTemplates(stateMachineName, customName, http)
69+
RequestTemplates: this.getIntegrationRequestTemplates(stateMachineName, customName, http),
7070
};
7171

7272
const integrationResponse = {
@@ -120,8 +120,8 @@ module.exports = {
120120
const stateMachineLogicalId = this.getStateMachineLogicalId(stateMachineName, customName);
121121
return {
122122
'application/json': this.buildDefaultRequestTemplate(stateMachineLogicalId),
123-
'application/x-www-form-urlencoded': this.buildDefaultRequestTemplate(stateMachineLogicalId)
124-
}
123+
'application/x-www-form-urlencoded': this.buildDefaultRequestTemplate(stateMachineLogicalId),
124+
};
125125
},
126126

127127
buildDefaultRequestTemplate(stateMachineLogicalId) {
@@ -136,7 +136,7 @@ module.exports = {
136136
'"}',
137137
],
138138
],
139-
}
139+
};
140140
},
141141

142142
getMethodResponses(http) {

lib/deploy/events/apiGateway/methods.test.js

Lines changed: 46 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -104,75 +104,87 @@ describe('#methods()', () => {
104104

105105
describe('#getIntegrationRequestTemplates()', () => {
106106
it('should set stateMachinelogical ID in default templates when customName is not set', () => {
107-
expect(serverlessStepFunctions.getIntegrationRequestTemplates('stateMachine')
108-
['application/json']['Fn::Join'][1][2].Ref)
107+
const requestTemplates = serverlessStepFunctions
108+
.getIntegrationRequestTemplates('stateMachine');
109+
expect(requestTemplates['application/json']['Fn::Join'][1][2].Ref)
109110
.to.be.equal('StateMachineStepFunctionsStateMachine');
110111
});
111112

112113
it('should set custom stateMachinelogical ID in default templates when customName is set',
113114
() => {
114-
expect(serverlessStepFunctions.getIntegrationRequestTemplates('stateMachine', 'custom')
115-
['application/json']['Fn::Join'][1][2].Ref)
115+
const requestTemplates = serverlessStepFunctions
116+
.getIntegrationRequestTemplates('stateMachine', 'custom');
117+
expect(requestTemplates['application/json']['Fn::Join'][1][2].Ref)
116118
.to.be.equal('Custom');
117119
});
118120

119121
it('should return the default template for application/json when one is not given', () => {
120-
const http_without_request_template = {
122+
const httpWithoutRequestTemplate = {
121123
path: 'foo/bar1',
122124
method: 'post',
123125
request: {
124126
template: {
125-
'application/x-www-form-urlencoded': 'custom template'
126-
}
127-
}
128-
}
129-
expect(serverlessStepFunctions.getMethodIntegration('stateMachine', undefined, http_without_request_template)
130-
.Properties.Integration.RequestTemplates['application/json']['Fn::Join'][1][2].Ref)
127+
'application/x-www-form-urlencoded': 'custom template',
128+
},
129+
},
130+
};
131+
const requestTemplates = serverlessStepFunctions
132+
.getMethodIntegration('stateMachine', undefined, httpWithoutRequestTemplate)
133+
.Properties.Integration.RequestTemplates;
134+
expect(requestTemplates['application/json']['Fn::Join'][1][2].Ref)
131135
.to.be.equal('StateMachineStepFunctionsStateMachine');
132136
});
133137

134138
it('should return a custom template for application/json when one is given', () => {
135-
const http_with_request_template = {
139+
const httpWithRequestTemplate = {
136140
path: 'foo/bar1',
137141
method: 'post',
138142
request: {
139143
template: {
140-
'application/json': 'custom template'
141-
}
142-
}
143-
}
144-
expect(serverlessStepFunctions.getMethodIntegration('stateMachine', undefined, http_with_request_template)
145-
.Properties.Integration.RequestTemplates['application/json'])
144+
'application/json': 'custom template',
145+
},
146+
},
147+
};
148+
const requestTemplates = serverlessStepFunctions
149+
.getMethodIntegration('stateMachine', undefined, httpWithRequestTemplate)
150+
.Properties.Integration.RequestTemplates;
151+
expect(requestTemplates['application/json'])
146152
.to.be.equal('custom template');
147153
});
148154

149-
it('should return the default template for application/x-www-form-urlencoded when one is not given', () => {
150-
const http_without_request_template = {
155+
it('should return the default for application/x-www-form-urlencoded when one is not given',
156+
() => {
157+
const httpWithoutRequestTemplate = {
151158
path: 'foo/bar1',
152159
method: 'post',
153160
request: {
154161
template: {
155-
'application/json': 'custom template'
156-
}
157-
}
158-
}
159-
expect(serverlessStepFunctions.getMethodIntegration('stateMachine', undefined, http_without_request_template)
160-
.Properties.Integration.RequestTemplates['application/x-www-form-urlencoded']['Fn::Join'][1][2].Ref)
162+
'application/json': 'custom template',
163+
},
164+
},
165+
};
166+
const requestTemplates = serverlessStepFunctions
167+
.getMethodIntegration('stateMachine', undefined, httpWithoutRequestTemplate)
168+
.Properties.Integration.RequestTemplates;
169+
expect(requestTemplates['application/x-www-form-urlencoded']['Fn::Join'][1][2].Ref)
161170
.to.be.equal('StateMachineStepFunctionsStateMachine');
162171
});
163172

164-
it('should return a custom template for application/x-www-form-urlencoded when one is given', () => {
165-
const http_with_request_template = {
173+
it('should return a custom template for application/x-www-form-urlencoded when one is given',
174+
() => {
175+
const httpWithRequestTemplate = {
166176
path: 'foo/bar1',
167177
method: 'post',
168178
request: {
169179
template: {
170-
'application/x-www-form-urlencoded': 'custom template'
171-
}
172-
}
173-
}
174-
expect(serverlessStepFunctions.getMethodIntegration('stateMachine', undefined, http_with_request_template)
175-
.Properties.Integration.RequestTemplates['application/x-www-form-urlencoded'])
180+
'application/x-www-form-urlencoded': 'custom template',
181+
},
182+
},
183+
};
184+
const requestTemplates = serverlessStepFunctions
185+
.getMethodIntegration('stateMachine', undefined, httpWithRequestTemplate)
186+
.Properties.Integration.RequestTemplates;
187+
expect(requestTemplates['application/x-www-form-urlencoded'])
176188
.to.be.equal('custom template');
177189
});
178190
});

0 commit comments

Comments
 (0)