-
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.
Merge pull request #1143 from Enterprise-CMCS/main
Release to val
- Loading branch information
Showing
19 changed files
with
425 additions
and
308 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.