Skip to content

Commit

Permalink
Add failure case
Browse files Browse the repository at this point in the history
  • Loading branch information
pearl-truss committed Nov 21, 2023
1 parent 9c26cfc commit 201eb8e
Show file tree
Hide file tree
Showing 2 changed files with 6,208 additions and 10,420 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -343,8 +343,41 @@ describe('createQuestion', () => {
toAddresses: expect.arrayContaining(
Array.from(stateReceiverEmails)
),
bodyHTML: expect.stringContaining(name),
bodyText: expect.stringContaining(
`CMS asked questions about ${name}`
),
bodyHTML: expect.stringContaining(
`<a href="http://localhost/submissions/${stateSubmission.id}">Open the submission in MC-Review to answer questions</a>`
),
})
)
})
it('does not send any emails if submission fails', async () => {
const mockEmailer = testEmailer()
const cmsServer = await constructTestPostgresServer({
context: {
user: cmsUser,
},
ldService: mockLDService,
emailer: mockEmailer,
})

const submitResult = await cmsServer.executeOperation({
query: CREATE_QUESTION,
variables: {
input: {
contractID: '1234',
documents: [
{
name: 'Test Question',
s3URL: 'testS3Url',
},
],
},
},
})

expect(submitResult.errors).toBeDefined()
expect(mockEmailer.sendEmail).not.toHaveBeenCalled()
})
})
Loading

0 comments on commit 201eb8e

Please sign in to comment.