d3ro-voice/apps/mobile-rn/__tests__/logout-scope-redteam-r2-1.test.ts

24 lines
832 B
TypeScript

// 로그아웃은 이 기기의 세션만 폐기한다(scope 'local').
// 기본값 'global' 은 계정의 모든 refresh token 을 폐기해 데스크톱까지 로그아웃시켰다.
const mockSignOut = jest.fn()
jest.mock('../src/lib/supabase', () => ({
supabase: {
auth: {
signOut: (...args: unknown[]) => mockSignOut(...args),
},
},
}))
import { signOutWithLocalFallback } from '../src/lib/logout'
describe('per-device logout scope', () => {
beforeEach(() => jest.clearAllMocks())
test('revokes only this device session, never the whole account', async () => {
mockSignOut.mockResolvedValue({ error: null })
await signOutWithLocalFallback(jest.fn(async () => undefined))
expect(mockSignOut).toHaveBeenCalledTimes(1)
expect(mockSignOut).toHaveBeenCalledWith({ scope: 'local' })
})
})