diff options
| author | Armand Philippot <git@armandphilippot.com> | 2023-12-11 17:52:38 +0100 |
|---|---|---|
| committer | Armand Philippot <git@armandphilippot.com> | 2023-12-11 17:52:38 +0100 |
| commit | 93db24b7f7650abac1bb7095026e3a1f367b0c0a (patch) | |
| tree | c6efd8669d333941494e573d2468a4fb6603b134 /src/services/graphql/mutators/send-email.test.ts | |
| parent | cd2cb5748be9e9c479d9802dd3897de1cd1cbd9f (diff) | |
refactor(pages): refine Contact page
* remove next/router dependency
* remove pageTitle since it is defined in MDX
* reduce statements by grouping messages
* mock response with MSW and add test for sendEmail
Diffstat (limited to 'src/services/graphql/mutators/send-email.test.ts')
| -rw-r--r-- | src/services/graphql/mutators/send-email.test.ts | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/src/services/graphql/mutators/send-email.test.ts b/src/services/graphql/mutators/send-email.test.ts new file mode 100644 index 0000000..dbba7ad --- /dev/null +++ b/src/services/graphql/mutators/send-email.test.ts @@ -0,0 +1,23 @@ +import { describe, expect, it } from '@jest/globals'; +import { type SendEmailInput, sendEmail } from './send-email'; + +describe('send-email', () => { + it('successfully sends an email', async () => { + const email: SendEmailInput = { + body: 'Natus soluta et.', + clientMutationId: 'qui', + replyTo: 'Nina.Jerde@example.net', + subject: 'quaerat odio veritatis', + }; + const result = await sendEmail(email); + + // eslint-disable-next-line @typescript-eslint/no-magic-numbers + expect.assertions(5); + + expect(result.clientMutationId).toBe(email.clientMutationId); + expect(result.message).toBeDefined(); + expect(result.origin).toBeDefined(); + expect(result.replyTo).toBe(email.replyTo); + expect(result.sent).toBe(true); + }); +}); |
