diff --git a/lib/lambda/processEmails.test.ts b/lib/lambda/processEmails.test.ts index 636aea900..e78f67e83 100644 --- a/lib/lambda/processEmails.test.ts +++ b/lib/lambda/processEmails.test.ts @@ -26,7 +26,7 @@ describe("process emails Handler", () => { Body: { Text: { Data: "This is a mocked email body.", Charset: "UTF-8" } }, }, }; - await expect(sendEmail(params, "test")).rejects.toThrowError(); + await expect(sendEmail(params, "bad-test")).rejects.toThrowError(); }); it("should validate the email template and throw an error", async () => { const template = { diff --git a/lib/libs/email/getAllStateUsers.ts b/lib/libs/email/getAllStateUsers.ts index b481fb534..e2b257267 100644 --- a/lib/libs/email/getAllStateUsers.ts +++ b/lib/libs/email/getAllStateUsers.ts @@ -12,10 +12,6 @@ export type StateUser = { formattedEmailAddress: string; }; -const cognitoClient = new CognitoIdentityProviderClient({ - region: process.env.region, -}); - export const getAllStateUsers = async ({ userPoolId, state, @@ -29,6 +25,9 @@ export const getAllStateUsers = async ({ Limit: 60, }; const command = new ListUsersCommand(params); + const cognitoClient = new CognitoIdentityProviderClient({ + region: process.env.region, + }); const response: ListUsersCommandOutput = await cognitoClient.send(command); if (!response.Users || response.Users.length === 0) { diff --git a/mocks/handlers/aws/email.ts b/mocks/handlers/aws/email.ts index 5ec43f75f..79064d161 100644 --- a/mocks/handlers/aws/email.ts +++ b/mocks/handlers/aws/email.ts @@ -20,7 +20,7 @@ export const emailHandlers = [ http.post("https://sqs.us-east-1.amazonaws.com/", async () => { return new HttpResponse(null, { status: 200 }); }), - http.post("https://email.us-east-1.amazonaws.com/", async () => { + http.post(`https://email.us-east-1.amazonaws.com/`, async () => { return HttpResponse.xml(`