Files
openchamber/packages/ui/src/sync/use-sync.test.ts
T

30 lines
867 B
TypeScript
Raw Normal View History

2026-06-11 23:06:19 +03:00
import { describe, expect, test } from 'bun:test'
import { shouldFetchSessionForRenderableSync } from './use-sync'
describe('shouldFetchSessionForRenderableSync', () => {
test('fetches full session detail when a lightweight list session is opened', () => {
expect(shouldFetchSessionForRenderableSync({
hasSession: true,
shouldLoadMessages: true,
force: false,
})).toBe(true)
})
test('skips session detail fetch when session and messages are already ready', () => {
expect(shouldFetchSessionForRenderableSync({
hasSession: true,
shouldLoadMessages: false,
force: false,
})).toBe(false)
})
test('fetches when the session record is missing', () => {
expect(shouldFetchSessionForRenderableSync({
hasSession: false,
shouldLoadMessages: false,
force: false,
})).toBe(true)
})
})