diff --git a/handlers/ticket-tailor-webhook/test/index.test.ts b/handlers/ticket-tailor-webhook/test/index.test.ts index b8897653ad..e8816d6ee5 100644 --- a/handlers/ticket-tailor-webhook/test/index.test.ts +++ b/handlers/ticket-tailor-webhook/test/index.test.ts @@ -29,30 +29,26 @@ 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( + 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 }, ); await handler(sqsEvent); + expect( - fetchMock.called( - `https://idapi.code.dev-theguardian.com/user/type/${emailAddress}`, - ), + fetchMock.calls().some(call => call[0] === `https://idapi.code.dev-theguardian.com/user/type/${emailAddress}`) ).toBe(true); expect( - fetchMock.called( - 'https://idapi.code.dev-theguardian.com/guest?accountVerificationEmail=true', - ), + fetchMock.calls().some(call => call[0] === 'https://idapi.code.dev-theguardian.com/guest?accountVerificationEmail=true') ).toBe(true); });