Skip to content

Commit

Permalink
fix(🐪): Rename some folders to CamelCase (#1019)
Browse files Browse the repository at this point in the history
* Rename some files to CamelCase

* Fix path

* Fix merge issues

* fixing imports

* one more time

---------

Co-authored-by: Thomas <[email protected]>
  • Loading branch information
benjaminpaige and thwalker6 authored Jan 14, 2025
1 parent aef7de7 commit e3deb2c
Show file tree
Hide file tree
Showing 81 changed files with 399 additions and 402 deletions.
134 changes: 134 additions & 0 deletions lib/lambda/processEmailsHandler.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
import { describe, it, expect, vi } from "vitest";
import { Context } from "aws-lambda";
import { SESClient } from "@aws-sdk/client-ses";
import { handler } from "./processEmails";
import { KafkaRecord, KafkaEvent } from "shared-types";
import { Authority } from "shared-types";

const nms = "new-medicaid-submission";
const ncs = "new-chip-submission";
const tempExtension = "temp-extension";
const withdrawPackage = "withdraw-package";
const contractingInitial = "contracting-initial";
const capitatedInitial = "capitated-initial";

describe("process emails Handler", () => {
it.each([
[`should send an email for ${nms} with ${Authority.MED_SPA}`, Authority.MED_SPA, nms],
[`should send an email for ${nms} with ${Authority.CHIP_SPA}`, Authority.CHIP_SPA, nms],
[`should send an email for ${nms} with ${Authority["1915b"]}`, Authority["1915b"], nms],
[`should send an email for ${nms} with ${Authority["1915c"]}`, Authority["1915c"], nms],
[`should send an email for ${ncs} with ${Authority.MED_SPA}`, Authority.MED_SPA, ncs],
[`should send an email for ${ncs} with ${Authority.CHIP_SPA}`, Authority.CHIP_SPA, ncs],
[`should send an email for ${ncs} with ${Authority["1915b"]}`, Authority["1915b"], ncs],
[`should send an email for ${ncs} with ${Authority["1915c"]}`, Authority["1915c"], ncs],
[
`should send an email for ${tempExtension} with ${Authority.MED_SPA}`,
Authority.MED_SPA,
tempExtension,
],
[
`should send an email for ${tempExtension} with ${Authority.CHIP_SPA}`,
Authority.CHIP_SPA,
tempExtension,
],
[
`should send an email for ${tempExtension} with ${Authority["1915b"]}`,
Authority["1915b"],
tempExtension,
],
[
`should send an email for ${tempExtension} with ${Authority["1915c"]}`,
Authority["1915c"],
tempExtension,
],
[
`should send an email for ${withdrawPackage} with ${Authority.MED_SPA}`,
Authority.MED_SPA,
withdrawPackage,
],
[
`should send an email for ${withdrawPackage} with ${Authority.CHIP_SPA}`,
Authority.CHIP_SPA,
withdrawPackage,
],
[
`should send an email for ${withdrawPackage} for ${ncs} with ${Authority["1915b"]}`,
Authority["1915b"],
withdrawPackage,
],
[
`should send an email for ${withdrawPackage} with ${Authority["1915c"]}`,
Authority["1915c"],
withdrawPackage,
],
[
`should send an email for ${contractingInitial} with ${Authority.MED_SPA}`,
Authority.MED_SPA,
contractingInitial,
],
[
`should send an email for ${contractingInitial} with ${Authority.CHIP_SPA}`,
Authority.CHIP_SPA,
contractingInitial,
],
[
`should send an email for ${contractingInitial} with ${Authority["1915b"]}`,
Authority["1915b"],
contractingInitial,
],
[
`should send an email for ${contractingInitial} with ${Authority["1915c"]}`,
Authority["1915c"],
contractingInitial,
],
[
`should send an email for ${capitatedInitial} with ${Authority.MED_SPA}`,
Authority.MED_SPA,
capitatedInitial,
],
[
`should send an email for ${capitatedInitial} with ${Authority.CHIP_SPA}`,
Authority.CHIP_SPA,
capitatedInitial,
],
[
`should send an email for ${capitatedInitial} with ${Authority["1915b"]}`,
Authority["1915b"],
capitatedInitial,
],
[
`should send an email for ${capitatedInitial} with ${Authority["1915c"]}`,
Authority["1915c"],
capitatedInitial,
],
])("%s", async (_, auth, eventType) => {
const callback = vi.fn();
const secSPY = vi.spyOn(SESClient.prototype, "send");
const mockEvent: KafkaEvent = {
records: {
"mock-topic": [
{
key: Buffer.from("VA").toString("base64"),
value: Buffer.from(
JSON.stringify({
origin: "mako",
event: eventType,
authority: auth,
}),
).toString("base64"),
headers: {},
timestamp: 1732645041557,
offset: "0",
partition: 0,
topic: "mock-topic",
} as unknown as KafkaRecord,
],
},
eventSource: "",
bootstrapServers: "",
};
await handler(mockEvent, {} as Context, callback);
expect(secSPY).toHaveBeenCalledTimes(2);
});
});
6 changes: 3 additions & 3 deletions lib/libs/email/content/index.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
export * from "./new-submission";
export * from "./newSubmission";
export * from "./tempExtension";
export * from "./respondToRai";
export * from "./withdrawRai";
export * from "./withdrawPackage";
export * from "./withdrawConfirmation";
export * from "./email-components";
export * from "./respondToRai";
export * from "./upload-subsequent-documents";
export * from "./uploadSubsequentDocuments";
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,11 @@ import {
} from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";

export const ChipSpaCMSEmail = (props: {
export const ChipSpaCMSEmail = ({
variables,
}: {
variables: Events["NewChipSubmission"] & CommonEmailVariables;
}) => {
const variables = props.variables;
const previewText = `CHIP SPA ${variables.id} Submitted`;
const heading = "The OneMAC Submission Portal received a CHIP State Plan Amendment:";
return (
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ import {
} from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";

export const MedSpaCMSEmail = (props: {
variables: Events["UploadSubsequentDocuments"] & CommonEmailVariables;
export const MedSpaCMSEmail = ({
variables,
}: {
variables: Events["UploadSubsequentDocuments"] & CommonEmailVariables
}) => {
const variables = props.variables;

return (
<BaseEmailTemplate
previewText={`Medicaid SPA ${variables.id}`}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,5 +4,5 @@ export { MedSpaCMSEmail } from "./MedSpaCMS";
export { MedSpaStateEmail } from "./MedSpaState";
export { AppKStateEmail } from "./AppKState";
export { AppKCMSEmail } from "./AppKCMS";
export { WaiversEmailCMS } from "./Waiver1915BCMS"
export { WaiversEmailState } from "./Waiver1915BState"
export { WaiversEmailCMS } from "./Waiver1915BCMS";
export { WaiversEmailState } from "./Waiver1915BState";
20 changes: 12 additions & 8 deletions lib/libs/email/content/withdrawRai/emailTemplates/AppKCMS.tsx
Original file line number Diff line number Diff line change
@@ -1,24 +1,28 @@
import { WithdrawRAI, PackageDetails, BasicFooter, Attachments } from "../../email-components";
import { WithdrawRAIProps } from "../../email-components";
import { CommonEmailVariables, EmailAddresses, Events } from "shared-types";
import { Attachments, PackageDetails, BasicFooter } from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";

export const AppKCMSEmail = ({ variables, relatedEvent }: WithdrawRAIProps) => {
export const AppKCMSEmail = ({
variables,
relatedEvent,
}: {
variables: Events["WithdrawRai"] & CommonEmailVariables & { emails: EmailAddresses };
relatedEvent: Events["RespondToRai"];
}) => {
const previewText = `Withdraw Formal RAI Response for Waiver Package ${relatedEvent.id}`;
const heading = `Withdraw Formal RAI Response for Waiver Package ${relatedEvent.id}`;

const heading = `The OneMAC Submission Portal received a request to withdraw the Formal RAI Response. You are receiving this email notification as the Formal RAI for ${relatedEvent.id} was withdrawn by ${variables.submitterName} ${variables.submitterEmail}.`;
return (
<BaseEmailTemplate
previewText={previewText}
heading={heading}
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={<BasicFooter />}
>
<WithdrawRAI relatedEvent={relatedEvent} variables={variables} />
<PackageDetails
details={{
"State or Territory": variables.territory,
Name: variables.submitterName,
"Email Address": variables.submitterEmail,
Name: relatedEvent.submitterName,
"Email Address": relatedEvent.submitterEmail,
"Waiver Number": variables.id,
Summary: variables.additionalInformation,
}}
Expand Down
17 changes: 11 additions & 6 deletions lib/libs/email/content/withdrawRai/emailTemplates/AppKState.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@ import {
WithdrawRAI,
} from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";
import { WithdrawRAIProps } from "../../email-components";
import { CommonEmailVariables, EmailAddresses, Events } from "shared-types";

export const AppKStateEmail = (props: WithdrawRAIProps) => {
const { variables, relatedEvent } = { ...props };
export const AppKStateEmail = ({
variables,
relatedEvent,
}: {
variables: Events["WithdrawRai"] & CommonEmailVariables & { emails: EmailAddresses };
relatedEvent: Events["RespondToRai"];
}) => {
const previewText = `Withdraw Formal RAI Response for Waiver Package ${relatedEvent.id}`;
const heading = `The OneMAC Submission Portal received a request to withdraw the Formal RAI Response. You are receiving this email notification as the Formal RAI for ${relatedEvent.id} was withdrawn by ${variables.submitterName} ${variables.submitterEmail}.`;
return (
Expand All @@ -23,10 +28,10 @@ export const AppKStateEmail = (props: WithdrawRAIProps) => {
<PackageDetails
details={{
"State or Territory": variables.territory,
Name: variables.submitterName,
"Email Address": variables.submitterEmail,
Name: relatedEvent.submitterName,
"Email Address": relatedEvent.submitterEmail,
"Waiver Number": variables.id,
Summary: variables.additionalInformation,
Summary: relatedEvent.additionalInformation,
}}
/>
<MailboxNotice type="Waiver" />
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,14 @@
import { WithdrawRAI, PackageDetails, BasicFooter, WithdrawRAIProps } from "../../email-components";
import { CommonEmailVariables, Events, EmailAddresses } from "shared-types";
import { WithdrawRAI, PackageDetails, BasicFooter } from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";

export const Waiver1915bCMSEmail = ({ variables, relatedEvent }: WithdrawRAIProps) => {
export const Waiver1915bCMSEmail = ({
variables,
relatedEvent,
}: {
variables: Events["WithdrawRai"] & CommonEmailVariables & { emails: EmailAddresses };
relatedEvent: Events["RespondToRai"];
}) => {
const previewText = `Waiver Package ${relatedEvent.id} withdrawn`;
const heading = `Withdraw Formal RAI Response for Waiver Package ${relatedEvent.id}`;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,30 +1,31 @@
import {
WithdrawRAI,
PackageDetails,
FollowUpNotice,
MailboxNotice,
WithdrawRAIProps,
} from "../../email-components";
import { CommonEmailVariables, EmailAddresses, Events } from "shared-types";
import { WithdrawRAI, PackageDetails, FollowUpNotice, MailboxNotice } from "../../email-components";
import { BaseEmailTemplate } from "../../email-templates";

export const Waiver1915bStateEmail = (props: WithdrawRAIProps) => {
const previewText = `Waiver ${props.relatedEvent.id} Withdrawn`;
export const Waiver1915bStateEmail = ({
variables,
relatedEvent,
}: {
variables: Events["WithdrawRai"] & CommonEmailVariables & { emails: EmailAddresses };
relatedEvent: Events["RespondToRai"];
}) => {
const previewText = `Waiver ${relatedEvent.id} Withdrawn`;
const heading = "This response confirms you have withdrawn a Waiver from CMS for review";
return (
<BaseEmailTemplate
previewText={previewText}
heading={heading}
applicationEndpointUrl={props.variables.applicationEndpointUrl}
applicationEndpointUrl={variables.applicationEndpointUrl}
footerContent={<FollowUpNotice />}
>
<WithdrawRAI variables={props.variables} relatedEvent={props.relatedEvent} />
<WithdrawRAI variables={variables} relatedEvent={relatedEvent} />
<PackageDetails
details={{
"State or Territory": props.variables.territory,
Name: props.variables.submitterName,
"Email Address": props.variables.submitterEmail,
"Waiver Number": props.variables.id,
Summary: props.variables.additionalInformation,
"State or Territory": variables.territory,
Name: relatedEvent.submitterName,
"Email Address": relatedEvent.submitterEmail,
"Waiver Number": variables.id,
Summary: relatedEvent.additionalInformation,
}}
/>
<MailboxNotice type="Waiver" />
Expand Down
4 changes: 2 additions & 2 deletions lib/libs/email/content/withdrawRai/emailTemplates/index.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
export { Waiver1915bCMSEmail } from "./Waiver1915bCMS";
export { Waiver1915bStateEmail } from "./Waiver1915bState";
export { AppKCMSEmail } from "./AppKCMS";
export { AppKStateEmail } from "./AppKState";
export { Waiver1915bCMSEmail } from "./Waiver1915bCMS";
export { Waiver1915bStateEmail } from "./Waiver1915bState";
Loading

0 comments on commit e3deb2c

Please sign in to comment.