feat: CORS enable button... small fixes

This commit is contained in:
Zakaria
2026-09-27 15:40:15 -04:00
parent b474e823ce
commit e8843a462b
2 changed files with 19 additions and 1 deletions
@@ -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) => {