Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

optimistic-ordered-refetch.test.ts

16 lines669 Bytes

1// Unit tests for the rank-tie probe classifier that the optimistic ordered
2// refetch oracle uses. The law (a boundary probe must select one rank) is owned
3// by optimistic-ordered-refetch-oracle.test.ts.
4import { expect, it } from 'vitest'
5import { isNarrowRankTieProbe } from './optimistic-ordered-refetch-probe.js'
6import type { Row } from './optimistic-ordered-refetch-probe.js'
7​
8it(`rejects an unordered page cap as a rank-tie probe`, () => {
9 const remote: Array<Row> = [1, 2, 3].map((id) => ({
10 id,
11 folder: `inbox`,
12 at: id,
13 }))
14 expect(isNarrowRankTieProbe({ limit: 1 }, remote)).toBe(false)
15 expect(isNarrowRankTieProbe({}, [])).toBe(false)
16})