Skip to content

Commit 827dafc

Browse files
committed
test(query): accept cursor metadata in offset fixture
1 parent b32bd48 commit 827dafc

1 file changed

Lines changed: 20 additions & 5 deletions

File tree

‎packages/query-db-collection/tests/cursor-pagination.integration.test.ts‎

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,8 @@ import type { Row, Scope } from './cursor-pagination/model.js'
2323
* cancellation, replacement, and cache reuse.
2424
*
2525
* The fixture endpoint supports prefix and rank-equality tie requests. Other
26-
* predicates and cursor expressions reject rather than silently dropping IR.
26+
* predicates reject rather than silently dropping IR. The fixture validates
27+
* cursor expressions, then chooses the explicit offset for its local reader.
2728
* Each tie filter has its own opaque backend sequence, just like the prefix.
2829
*/
2930
function createFixture(
@@ -97,10 +98,24 @@ function createFixture(
9798
}
9899
reader = tie
99100
}
100-
expect(
101-
options?.cursor,
102-
`fixture uses offset requests, not IR cursors`,
103-
).toBeUndefined()
101+
if (options?.cursor) {
102+
expect(options.cursor.whereCurrent).toMatchObject({
103+
type: `func`,
104+
name: `eq`,
105+
args: [
106+
{ type: `ref`, path: [`rank`] },
107+
{ type: `val`, value: expect.any(Number) },
108+
],
109+
})
110+
expect(options.cursor.whereFrom).toMatchObject({
111+
type: `func`,
112+
name: scope.descending ? `lt` : `gt`,
113+
args: [
114+
{ type: `ref`, path: [`rank`] },
115+
{ type: `val`, value: expect.any(Number) },
116+
],
117+
})
118+
}
104119
if (options?.orderBy) {
105120
expect(options.orderBy).toMatchObject([
106121
{ expression: { path: [`rank`] }, compareOptions: { direction } },

0 commit comments

Comments
 (0)