Skip to content

Commit

Permalink
feat(test) fix email test (#991)
Browse files Browse the repository at this point in the history
* feat(test) fix email test
* Update processEmails.test.ts
  • Loading branch information
thwalker6 authored Jan 8, 2025
1 parent 6fab5d0 commit ea3e350
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/lambda/processEmails.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand Down
2 changes: 1 addition & 1 deletion lib/libs/email/content/new-submission/index.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { Events, Authority, EmailAddresses, CommonEmailVariables } from "shared-types";
import { formatActionType } from "lib/packages/shared-utils";
import { formatActionType } from "shared-utils";
import { AuthoritiesWithUserTypesTemplate } from "../..";
import {
MedSpaCMSEmail,
Expand Down
7 changes: 3 additions & 4 deletions lib/libs/email/getAllStateUsers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,6 @@ export type StateUser = {
formattedEmailAddress: string;
};

const cognitoClient = new CognitoIdentityProviderClient({
region: process.env.region,
});

export const getAllStateUsers = async ({
userPoolId,
state,
Expand All @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion mocks/handlers/aws/email.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export const emailHandlers = [
http.post<PathParams>("https://sqs.us-east-1.amazonaws.com/", async () => {
return new HttpResponse(null, { status: 200 });
}),
http.post<PathParams>("https://email.us-east-1.amazonaws.com/", async () => {
http.post<PathParams>(`https://email.us-east-1.amazonaws.com/`, async () => {
return HttpResponse.xml(`
<SendEmailResponse xmlns="http://ses.amazonaws.com/doc/2010-12-01/">
<SendEmailResult>
Expand Down

0 comments on commit ea3e350

Please sign in to comment.