diff --git a/packages/auth-providers/dbAuth/middleware/src/__tests__/initDbAuthMiddleware.test.ts b/packages/auth-providers/dbAuth/middleware/src/__tests__/initDbAuthMiddleware.test.ts index 4a92ad8bf52b..8f76b0017c84 100644 --- a/packages/auth-providers/dbAuth/middleware/src/__tests__/initDbAuthMiddleware.test.ts +++ b/packages/auth-providers/dbAuth/middleware/src/__tests__/initDbAuthMiddleware.test.ts @@ -23,22 +23,24 @@ beforeAll(() => { vi.mock('@redwoodjs/auth-dbauth-api', async (importOriginal) => { const original = (await importOriginal()) as any return { - ...original, - dbAuthSession: vi.fn().mockImplementation((req, cookieName) => { - if ( - req.headers - .get('Cookie') - .includes(`${cookieName}=this_is_the_only_correct_session`) - ) { - return { - currentUser: { - email: 'user-1@example.com', - id: 'mocked-current-user-1', - }, - mockedSession: 'this_is_the_only_correct_session', + default: { + ...original, + dbAuthSession: vi.fn().mockImplementation((req, cookieName) => { + if ( + req.headers + .get('Cookie') + .includes(`${cookieName}=this_is_the_only_correct_session`) + ) { + return { + currentUser: { + email: 'user-1@example.com', + id: 'mocked-current-user-1', + }, + mockedSession: 'this_is_the_only_correct_session', + } } - } - }), + }), + }, } }) })