Skip to content

Commit

Permalink
Swap dev team email parameter store tests with help desk email.
Browse files Browse the repository at this point in the history
  • Loading branch information
JasonLin0991 committed Aug 15, 2023
1 parent 1f4e846 commit 827957f
Showing 1 changed file with 11 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
getOACTEmails,
getCmsReviewHelpEmail,
getCmsRateHelpEmail,
getCmsDevTeamHelpEmail,
getDevReviewTeamEmails,
getHelpDeskEmail,
} from './'
import { ParameterStore } from '../awsParameterStore'

Expand Down Expand Up @@ -177,20 +177,22 @@ describe('emailParameterStore', () => {
})
})

describe('getCmsDevTeamHelpEmail', () => {
it('returns dev team help email as string', async () => {
describe('getHelpDeskEmail', () => {
it('returns help desk email as string', async () => {
const spy = jest.spyOn(ParameterStore, 'getParameter')
spy.mockResolvedValue({
value: `"MC-Review Support" <mc-review@example.com>`,
value: `"MC-Review Help Desk" <MC_Review_HelpDesk@example.com>`,
type: 'String',
})
const result = await getCmsDevTeamHelpEmail()
expect(result).toBe(`"MC-Review Support" <mc-review@example.com>`)
const result = await getHelpDeskEmail()
expect(result).toBe(
`"MC-Review Help Desk" <MC_Review_HelpDesk@example.com>`
)
})
it('returns error when fetching store value fails', async () => {
const spy = jest.spyOn(ParameterStore, 'getParameter')
spy.mockResolvedValue(new Error('No store found'))
const result = await getCmsDevTeamHelpEmail()
const result = await getHelpDeskEmail()
expect(result).toBeInstanceOf(Error)
})
it('returns error when Type of parameter store value is incompatible', async () => {
Expand All @@ -199,10 +201,10 @@ describe('emailParameterStore', () => {
value: '"CMS Source Email" <local@example.com>',
type: 'StringList',
})
const result = await getCmsDevTeamHelpEmail()
const result = await getHelpDeskEmail()
expect(result).toEqual(
new Error(
'Parameter store /configuration/email/devTeamHelpAddress value of Type StringList is not supported'
'Parameter store /configuration/email/helpDeskAddress value of Type StringList is not supported'
)
)
})
Expand Down

0 comments on commit 827957f

Please sign in to comment.