feat(release): prepare 1.1.0 candidate
This commit is contained in:
parent
5a34f66981
commit
5205dcdfa9
736 changed files with 115667 additions and 12203 deletions
55
apps/mobile-rn/__tests__/logout.test.ts
Normal file
55
apps/mobile-rn/__tests__/logout.test.ts
Normal file
|
|
@ -0,0 +1,55 @@
|
|||
const mockSignOut = jest.fn()
|
||||
|
||||
jest.mock('../src/lib/supabase', () => ({
|
||||
supabase: {
|
||||
auth: {
|
||||
signOut: (...args: unknown[]) => mockSignOut(...args),
|
||||
},
|
||||
},
|
||||
}))
|
||||
|
||||
import { signOutWithLocalFallback } from '../src/lib/logout'
|
||||
|
||||
describe('offline-safe logout boundary', () => {
|
||||
beforeEach(() => jest.clearAllMocks())
|
||||
|
||||
test('confirms remote revocation and still performs the secure local purge', async () => {
|
||||
mockSignOut.mockResolvedValue({ error: null })
|
||||
const purge = jest.fn(async () => undefined)
|
||||
|
||||
await expect(signOutWithLocalFallback(purge)).resolves.toEqual({
|
||||
remoteRevocationConfirmed: true,
|
||||
})
|
||||
expect(purge).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
test('logs this device out when the revocation endpoint is offline', async () => {
|
||||
mockSignOut.mockResolvedValue({ error: new Error('offline') })
|
||||
const purge = jest.fn(async () => undefined)
|
||||
|
||||
await expect(signOutWithLocalFallback(purge)).resolves.toEqual({
|
||||
remoteRevocationConfirmed: false,
|
||||
})
|
||||
expect(purge).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
test('also purges locally when the auth client throws a transport error', async () => {
|
||||
mockSignOut.mockRejectedValue(new Error('network down'))
|
||||
const purge = jest.fn(async () => undefined)
|
||||
|
||||
await expect(signOutWithLocalFallback(purge)).resolves.toEqual({
|
||||
remoteRevocationConfirmed: false,
|
||||
})
|
||||
expect(purge).toHaveBeenCalledTimes(1)
|
||||
})
|
||||
|
||||
test('never reports logout success if secure local deletion fails', async () => {
|
||||
mockSignOut.mockResolvedValue({ error: new Error('offline') })
|
||||
const purge = jest.fn(async () => {
|
||||
throw new Error('keychain deletion failed')
|
||||
})
|
||||
|
||||
await expect(signOutWithLocalFallback(purge))
|
||||
.rejects.toThrow('keychain deletion failed')
|
||||
})
|
||||
})
|
||||
Loading…
Add table
Add a link
Reference in a new issue