feat: CORS enable button... small fixes
This commit is contained in:
@@ -310,6 +310,24 @@ describe('AwsApiGatewayAdapter', () => {
|
||||
expect((lambdaCommands[0] as RemovePermissionCommand).input).toMatchObject({FunctionName: 'hello', StatementId: 'apigateway-a1b2c3-dev-POST-hello'})
|
||||
})
|
||||
|
||||
test('deletes a CORS OPTIONS method and redeploys its stage', async () => {
|
||||
const commands: unknown[] = []
|
||||
const adapter = new AwsApiGatewayAdapter(fakeClient((command) => {
|
||||
commands.push(command)
|
||||
if (command instanceof GetMethodCommand) {
|
||||
return {methodIntegration: {type: 'MOCK'}}
|
||||
}
|
||||
return {}
|
||||
}), fakeLambda(() => ({})))
|
||||
|
||||
await adapter.deleteApiGatewayRoute('a1b2c3', {resourceId: 'resource456', path: '/hello', method: 'OPTIONS', stage: 'dev'})
|
||||
|
||||
expect(commands.map((command) => (command as {constructor: {name: string}}).constructor.name)).toEqual([
|
||||
'GetMethodCommand', 'DeleteMethodCommand', 'CreateDeploymentCommand',
|
||||
])
|
||||
expect((commands[1] as DeleteMethodCommand).input).toMatchObject({httpMethod: 'OPTIONS'})
|
||||
})
|
||||
|
||||
test('enables CORS for non-proxy methods, creates OPTIONS, and reports proxy methods', async () => {
|
||||
const commands: unknown[] = []
|
||||
const adapter = new AwsApiGatewayAdapter(fakeClient((command) => {
|
||||
|
||||
Reference in New Issue
Block a user