Skip to content

Commit

Permalink
-
Browse files Browse the repository at this point in the history
  • Loading branch information
shtukas committed Dec 9, 2024
1 parent 964eb90 commit d506e2b
Showing 1 changed file with 5 additions and 6 deletions.
11 changes: 5 additions & 6 deletions handlers/ticket-tailor-webhook/test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,17 +28,16 @@ beforeEach(() => {
});

test('calls create guest account for new email addresses', async () => {
jest.useFakeTimers().setSystemTime(new Date(validEpochSeconds * 1000)); //Date works in Epoch milli
fetchMock.route(
jest.useFakeTimers().setSystemTime(new Date(validEpochSeconds * 1000)); // Date works in Epoch milli
fetchMock.get(
`https://idapi.code.dev-theguardian.com/user/type/${emailAddress}`,
new Response(JSON.stringify({ userType: 'new' })),
);

fetchMock.route(
fetchMock.post(
'https://idapi.code.dev-theguardian.com/guest?accountVerificationEmail=true',
{
body: { primaryEmailAddress: emailAddress },
method: 'POST',
status: 200
},
);
Expand All @@ -57,8 +56,8 @@ test('calls create guest account for new email addresses', async () => {
});

test('no call to create guest account for an existing email addresses', async () => {
jest.useFakeTimers().setSystemTime(new Date(validEpochSeconds * 1000)); //Date works in Epoch milli
fetchMock.route(
jest.useFakeTimers().setSystemTime(new Date(validEpochSeconds * 1000)); // Date works in Epoch milli
fetchMock.get(
`https://idapi.code.dev-theguardian.com/user/type/${emailAddress}`,
new Response(JSON.stringify({ userType: 'current' })),
);
Expand Down

0 comments on commit d506e2b

Please sign in to comment.