-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(ui): fixed medspa, chipspa, waivers emails for cms and state (#1125)
* fix(ui): fixed medspa, chipspa, waivers emails for cms and state * fix(ui): fixed medspa, chipspa, waivers emails for cms and state * eslint * eslint * coverage * add tests for withdraw RAI chip and med spa * coverage * tiff f changes * add WithdrawRai component back temporarily * coverage * coverage * waiver emailsstopped working * added waiver component to test again * removed withdrawrai from test, and failing to find it * added unit test and fixed heading * fixed unit test, removed appk files no longer needed and tests associated with it * coverage * Update lib/libs/email/content/withdrawRai/emailTemplates/WaiverState.tsx Co-authored-by: tiffanyvu <[email protected]> * removed note * added like the one above --------- Co-authored-by: tiffanyvu <[email protected]>
- Loading branch information
Showing
17 changed files
with
416 additions
and
299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
67 changes: 67 additions & 0 deletions
67
lib/libs/email/content/withdrawRai/emailComponents.test.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { render, screen } from "@testing-library/react"; | ||
import { expect, test, vi } from "vitest"; | ||
import { | ||
EMAIL_CONFIG, | ||
areAllAttachmentsEmpty, | ||
Textarea, | ||
DetailsHeading, | ||
getCpocEmail, | ||
} from "../email-components"; | ||
|
||
// 🟢 Test EMAIL_CONFIG | ||
test("EMAIL_CONFIG contains correct email addresses", () => { | ||
expect(EMAIL_CONFIG.DEV_EMAIL).toBe("[email protected]"); | ||
expect(EMAIL_CONFIG.CHIP_EMAIL).toBe("[email protected]"); | ||
expect(EMAIL_CONFIG.SPA_EMAIL).toBe("[email protected]"); | ||
expect(EMAIL_CONFIG.SPAM_EMAIL).toBe("[email protected]"); | ||
}); | ||
|
||
// 🟢 Test areAllAttachmentsEmpty | ||
test("areAllAttachmentsEmpty returns true for empty attachments", () => { | ||
expect(areAllAttachmentsEmpty({})).toBe(true); | ||
expect(areAllAttachmentsEmpty({ title1: undefined })).toBe(true); // | ||
expect(areAllAttachmentsEmpty({ title2: { label: "Test", files: [] } })).toBe(true); | ||
}); | ||
|
||
test("areAllAttachmentsEmpty returns false when at least one attachment contains files", () => { | ||
expect( | ||
areAllAttachmentsEmpty({ | ||
title1: { | ||
label: "Test", | ||
files: [ | ||
{ | ||
key: "12345", | ||
filename: "file1.pdf", | ||
title: "Document Title", | ||
bucket: "my-bucket", | ||
uploadDate: 1700000000, | ||
}, | ||
], | ||
}, | ||
}), | ||
).toBe(false); | ||
}); | ||
|
||
// 🟢 Test Textarea Component | ||
test("renders Textarea component with children", () => { | ||
render(<Textarea>This is a test</Textarea>); | ||
expect(screen.getByText("This is a test")).toBeTruthy(); | ||
}); | ||
|
||
// 🟢 Test DetailsHeading Component | ||
test("renders DetailsHeading with correct text", () => { | ||
render(<DetailsHeading />); | ||
expect(screen.getByText("Details:")).toBeTruthy(); | ||
}); | ||
|
||
// 🟢 Test getCpocEmail | ||
test("returns an empty array and logs error when an exception occurs in getCpocEmail", () => { | ||
const consoleErrorMock = vi.spyOn(console, "error").mockImplementation(() => {}); | ||
|
||
const result = getCpocEmail(undefined); | ||
|
||
expect(result).toEqual([]); | ||
expect(console.error).toHaveBeenCalled(); | ||
|
||
consoleErrorMock.mockRestore(); | ||
}); |
33 changes: 0 additions & 33 deletions
33
lib/libs/email/content/withdrawRai/emailTemplates/AppKCMS.tsx
This file was deleted.
Oops, something went wrong.
41 changes: 0 additions & 41 deletions
41
lib/libs/email/content/withdrawRai/emailTemplates/AppKState.tsx
This file was deleted.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
lib/libs/email/content/withdrawRai/emailTemplates/ChipSPACMS.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { CommonEmailVariables, Events } from "shared-types"; | ||
import { Attachments, BasicFooter, Divider, PackageDetails } from "../../email-components"; | ||
import { BaseEmailTemplate } from "../../email-templates"; | ||
|
||
export const ChipSpaCMSEmail = ({ | ||
variables, | ||
}: { | ||
variables: Events["WithdrawRai"] & CommonEmailVariables; | ||
}) => ( | ||
<BaseEmailTemplate | ||
previewText={`Withdraw Formal RAI Response for CHIP SPA Package ${variables.id}`} | ||
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 ${variables.id} was withdrawn by ${variables.submitterName} ${variables.submitterEmail}.`} | ||
applicationEndpointUrl={variables.applicationEndpointUrl} | ||
footerContent={<BasicFooter />} | ||
> | ||
<Divider /> | ||
<PackageDetails | ||
details={{ | ||
"State or Territory": variables.territory, | ||
Name: variables.submitterName, | ||
"Email Address": variables.submitterEmail, | ||
"CHIP SPA Package ID": variables.id, | ||
Summary: variables.additionalInformation, | ||
}} | ||
/> | ||
<Attachments attachments={variables.attachments} /> | ||
</BaseEmailTemplate> | ||
); |
28 changes: 28 additions & 0 deletions
28
lib/libs/email/content/withdrawRai/emailTemplates/ChipSPAState.tsx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
import { CommonEmailVariables, Events } from "shared-types"; | ||
import { FollowUpNotice, BasicFooter, Divider, PackageDetails } from "../../email-components"; | ||
import { BaseEmailTemplate } from "../../email-templates"; | ||
|
||
export const ChipSpaStateEmail = ({ | ||
variables, | ||
}: { | ||
variables: Events["WithdrawRai"] & CommonEmailVariables; | ||
}) => ( | ||
<BaseEmailTemplate | ||
previewText={`Withdraw Formal RAI Response for CHIP SPA Package ${variables.id}`} | ||
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 ${variables.id} was withdrawn by ${variables.submitterName} ${variables.submitterEmail}.`} | ||
applicationEndpointUrl={variables.applicationEndpointUrl} | ||
footerContent={<BasicFooter />} | ||
> | ||
<Divider /> | ||
<PackageDetails | ||
details={{ | ||
"State or Territory": variables.territory, | ||
Name: variables.submitterName, | ||
"Email Address": variables.submitterEmail, | ||
"CHIP SPA Package ID": variables.id, | ||
Summary: variables.additionalInformation, | ||
}} | ||
/> | ||
<FollowUpNotice isChip /> | ||
</BaseEmailTemplate> | ||
); |
Oops, something went wrong.