-
Notifications
You must be signed in to change notification settings - Fork 3
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
MCR-4888: Add update email settings api #3104
Closed
+602
−35
Closed
Changes from 1 commit
Commits
Show all changes
32 commits
Select commit
Hold shift + click to select a range
7f099b9
Pull out emailer configuration into a function.
JasonLin0991 8ae1227
Use configureEmailer in unit tests
JasonLin0991 e8fcfeb
Remove cms email from defaults
JasonLin0991 e749e07
Add settings domain types
JasonLin0991 4358881
Add postgres function to find email settings
JasonLin0991 f12bf85
Abstract email configuration code ,add code to pull from data from DB…
JasonLin0991 ec60299
Update usage of ldService
JasonLin0991 798cc9b
Refactor constructTestEmailer
JasonLin0991 1db1248
Add tests
JasonLin0991 e85e09c
Make test emailer using DB
JasonLin0991 ab63bc7
Update schema
JasonLin0991 db872cb
Merge branch 'main' into mcr-4893-adjust-apollo-gql-hanlder-to-use-fe…
JasonLin0991 3fa1971
Remove stage and baseUrl from graphql email configuration
JasonLin0991 1e838c1
Add custom validator for email alias and unit test it.
JasonLin0991 b4a25c1
Fix type errors
JasonLin0991 4e1823d
update email settings postgres function
JasonLin0991 f6d6246
Add updateEmailSettings to graphql
JasonLin0991 2beeb69
Add updateEmailSettings resolver
JasonLin0991 da2de2b
Add updateEmailSettings resolver tests
JasonLin0991 8275b1a
trim white space in emails on validation and add test
JasonLin0991 91a4ab3
Add another test for empty email settings field
JasonLin0991 a00b963
add type name to mock
JasonLin0991 c6eb31c
Fix typo in EmailSettings default values.
JasonLin0991 65c2bcf
Merge branch 'mcr-4893-adjust-apollo-gql-hanlder-to-use-feature-flag'…
JasonLin0991 4c808c1
Typo in test
JasonLin0991 e1035e2
Get rid of email display names
JasonLin0991 05f891d
Add a comment about database email settings updates and the emailer d…
JasonLin0991 96a8c3f
Merge branch 'mcr-4893-adjust-apollo-gql-hanlder-to-use-feature-flag'…
JasonLin0991 e890ef3
Update unit test
JasonLin0991 283532e
Merge branch 'mcr-4893-adjust-apollo-gql-hanlder-to-use-feature-flag'…
JasonLin0991 708e7c9
Merge remote-tracking branch 'origin/main' into jl-mcr-4888-add-updat…
haworku 2d96a12
add caching to configureEmailerFromDB. 1 min.
mojotalantikite File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Add custom validator for email alias and unit test it.
commit 1e838c10ab0cc2a55f6bec4567c618d8b6c355e6
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,66 @@ | ||
import { emailSettingsSchema } from './SettingType' | ||
|
||
describe('emailSettingsSchema', () => { | ||
const validEmailsWithAlias = { | ||
emailSource: '"MC-Review CMS HHS" <local@example.com>', | ||
devReviewTeamEmails: [ | ||
'"Dev Reviewer 1" <Dev.reviewer.1@example.com>', | ||
'"Dev Reviewer 2" <Dev.reviewer.2@example.com>', | ||
], | ||
oactEmails: ['"OACT Reviewer 1" <oact-reviewer.1@example.com>'], | ||
dmcpReviewEmails: ['"DMCP Reviewer 1" <dmcp-reviewer.1@example.com>'], | ||
dmcpSubmissionEmails: [ | ||
'"DMCP Submission 1" <dmcp-submission.1@example.com>', | ||
'"DMCP Submission 2" <dmcp-submission.2@example.com>', | ||
], | ||
dmcoEmails: ['"DMCO Reviewer 1" <dmco-reviewer.1@example.com>'], | ||
cmsReviewHelpEmailAddress: [ | ||
'"Contract Help" <contract.help@example.com>', | ||
], | ||
cmsRateHelpEmailAddress: ['"Rate Help" <rate.help@example.com>'], | ||
helpDeskEmail: ['"Help Desk" <helpdesk@example.com>'], | ||
} | ||
|
||
const validEmailsWithoutAlias = { | ||
emailSource: 'local@example.com', | ||
devReviewTeamEmails: ['dev1@example.com'], | ||
oactEmails: ['oact1@example.com', 'oact2@example.com'], | ||
dmcpReviewEmails: ['dmcp1@example.com'], | ||
dmcpSubmissionEmails: ['dmcp.sub1@example.com'], | ||
dmcoEmails: ['dmco1@example.com'], | ||
cmsReviewHelpEmailAddress: ['cms.review@example.com'], | ||
cmsRateHelpEmailAddress: ['cms.rate@example.com'], | ||
helpDeskEmail: ['help@example.com'], | ||
} | ||
|
||
it('should validate emails with display names', () => { | ||
const result = emailSettingsSchema.safeParse(validEmailsWithAlias) | ||
expect(result.success).toBe(true) | ||
}) | ||
|
||
it('should validate plain emails', () => { | ||
const result = emailSettingsSchema.safeParse(validEmailsWithoutAlias) | ||
expect(result.success).toBe(true) | ||
}) | ||
|
||
it('should reject invalid email format', () => { | ||
const invalidData = { ...validEmailsWithAlias } | ||
invalidData.emailSource = 'invalid-email' | ||
const result = emailSettingsSchema.safeParse(invalidData) | ||
expect(result.success).toBe(false) | ||
}) | ||
|
||
it('should reject empty email arrays', () => { | ||
const invalidData = { ...validEmailsWithAlias } | ||
invalidData.devReviewTeamEmails = [] | ||
const result = emailSettingsSchema.safeParse(invalidData) | ||
expect(result.success).toBe(false) | ||
}) | ||
|
||
it('should reject malformed email aliases', () => { | ||
const invalidData = { ...validEmailsWithAlias } | ||
invalidData.emailSource = '"Bad Format" bad@example.com>' | ||
const result = emailSettingsSchema.safeParse(invalidData) | ||
expect(result.success).toBe(false) | ||
}) | ||
}) |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JasonLin0991 ⭐on covering the test cases