From dcaaa39575cca4d7753987ed25dc9963f199cfd4 Mon Sep 17 00:00:00 2001 From: Gabriel Date: Thu, 19 Sep 2024 19:59:46 -0300 Subject: [PATCH] test: ensure fetch is called with correct URL and headers in user sync API Co-Authored-By: Natalia Rodrigues --- src/app/__tests__/watermelon.service.spec.tsx | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/app/__tests__/watermelon.service.spec.tsx b/src/app/__tests__/watermelon.service.spec.tsx index 826ddb60..539cf54a 100644 --- a/src/app/__tests__/watermelon.service.spec.tsx +++ b/src/app/__tests__/watermelon.service.spec.tsx @@ -56,5 +56,15 @@ describe('syncDatabaseWithServer', () => { }) }) ); + + expect(fetch).toHaveBeenCalledWith( + expect.stringMatching(/\/api\/usuario\/sync\/pull_users\?lastPulledAt=0&schemaVersion=1&migration=1/), + expect.objectContaining({ + method: 'GET', + headers: expect.objectContaining({ + Authorization: `Bearer ${mockToken}` + }) + }) + ); }); });