feat(api): show a user pool's Lambda triggers
This commit is contained in:
@@ -125,9 +125,31 @@ describe('AwsUserPoolsAdapter', () => {
|
||||
mfaConfiguration: 'OFF',
|
||||
deletionProtection: 'INACTIVE',
|
||||
appClients: [{clientId: 'a8e5c7d38d3b4a1a97c9d822de', clientName: 'orders-users-client'}],
|
||||
lambdaTriggers: [],
|
||||
})
|
||||
})
|
||||
|
||||
test('lists the pool\'s Lambda triggers in sign-in order, with the trigger version when set', async () => {
|
||||
const arn = (name: string) => `arn:aws:lambda:us-east-1:000000000000:function:${name}`
|
||||
const {client} = stubCognito((command) => {
|
||||
if (command instanceof DescribeUserPoolCommand) return {UserPool: {...pool, LambdaConfig: {
|
||||
PreTokenGeneration: arn('claims'),
|
||||
PreTokenGenerationConfig: {LambdaArn: arn('claims'), LambdaVersion: 'V2_0'},
|
||||
PreSignUp: `${arn('signup')}:live`,
|
||||
CustomEmailSender: {LambdaArn: arn('mailer'), LambdaVersion: 'V1_0'},
|
||||
KMSKeyID: 'arn:aws:kms:us-east-1:000000000000:key/1',
|
||||
}}}
|
||||
return {}
|
||||
})
|
||||
|
||||
const resource = await new AwsUserPoolsAdapter(client).get(POOL_ID)
|
||||
expect(resource?.metadata.lambdaTriggers).toEqual([
|
||||
{trigger: 'PreSignUp', label: 'Pre sign-up', functionArn: `${arn('signup')}:live`, functionName: 'signup', version: null},
|
||||
{trigger: 'PreTokenGeneration', label: 'Pre token generation', functionArn: arn('claims'), functionName: 'claims', version: 'V2_0'},
|
||||
{trigger: 'CustomEmailSender', label: 'Custom email sender', functionArn: arn('mailer'), functionName: 'mailer', version: 'V1_0'},
|
||||
])
|
||||
})
|
||||
|
||||
test('counts users itself, since the runtime leaves EstimatedNumberOfUsers at 0', async () => {
|
||||
const {client} = stubCognito((command) => {
|
||||
if (command instanceof DescribeUserPoolCommand) return {UserPool: {...pool, EstimatedNumberOfUsers: 0}}
|
||||
|
||||
Reference in New Issue
Block a user