Skip to content

Commit 1c327da

Browse files
committed
remove dead code, and fix test
1 parent fb0c7c5 commit 1c327da

2 files changed

Lines changed: 6 additions & 14 deletions

File tree

apps/sim/app/api/auth/[...all]/route.test.ts

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,9 @@ const handlerMocks = vi.hoisted(() => ({
88
betterAuthGET: vi.fn(),
99
betterAuthPOST: vi.fn(),
1010
ensureAnonymousUserExists: vi.fn(),
11-
createAnonymousGetSessionResponse: vi.fn(() => ({
12-
data: {
13-
user: { id: 'anon' },
14-
session: { id: 'anon-session' },
15-
},
11+
createAnonymousSession: vi.fn(() => ({
12+
user: { id: 'anon' },
13+
session: { id: 'anon-session' },
1614
})),
1715
isAuthDisabled: false,
1816
}))
@@ -30,7 +28,7 @@ vi.mock('@/lib/auth', () => ({
3028

3129
vi.mock('@/lib/auth/anonymous', () => ({
3230
ensureAnonymousUserExists: handlerMocks.ensureAnonymousUserExists,
33-
createAnonymousGetSessionResponse: handlerMocks.createAnonymousGetSessionResponse,
31+
createAnonymousSession: handlerMocks.createAnonymousSession,
3432
}))
3533

3634
vi.mock('@/lib/core/config/feature-flags', () => ({
@@ -63,10 +61,8 @@ describe('auth catch-all route (DISABLE_AUTH get-session)', () => {
6361
expect(handlerMocks.ensureAnonymousUserExists).toHaveBeenCalledTimes(1)
6462
expect(handlerMocks.betterAuthGET).not.toHaveBeenCalled()
6563
expect(json).toEqual({
66-
data: {
67-
user: { id: 'anon' },
68-
session: { id: 'anon-session' },
69-
},
64+
user: { id: 'anon' },
65+
session: { id: 'anon-session' },
7066
})
7167
})
7268

apps/sim/lib/auth/anonymous.ts

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,3 @@ export function createAnonymousSession(): AnonymousSession {
103103
},
104104
}
105105
}
106-
107-
export function createAnonymousGetSessionResponse(): { data: AnonymousSession } {
108-
return { data: createAnonymousSession() }
109-
}

0 commit comments

Comments
 (0)