Updating test case - not exactly sure what it was testing before, but now it definitely confirms paginated results are stable.
This commit is contained in:
parent
763c04048c
commit
3345364675
|
@ -1548,19 +1548,32 @@ describe.each([
|
||||||
// be stable or pagination will break. We don't want the user to need
|
// be stable or pagination will break. We don't want the user to need
|
||||||
// to specify an order for pagination to work.
|
// to specify an order for pagination to work.
|
||||||
it("is stable without a sort specified", async () => {
|
it("is stable without a sort specified", async () => {
|
||||||
let { rows } = await config.api.row.search(table._id!, {
|
let { rows: fullRowList } = await config.api.row.search(
|
||||||
tableId: table._id!,
|
table._id!,
|
||||||
query: {},
|
{
|
||||||
})
|
tableId: table._id!,
|
||||||
|
query: {},
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|
||||||
for (let i = 0; i < 10; i++) {
|
// repeat the search many times to check the first row is always the same
|
||||||
|
let bookmark: string | number | undefined,
|
||||||
|
hasNextPage: boolean | undefined = true,
|
||||||
|
rowCount: number = 0
|
||||||
|
do {
|
||||||
const response = await config.api.row.search(table._id!, {
|
const response = await config.api.row.search(table._id!, {
|
||||||
tableId: table._id!,
|
tableId: table._id!,
|
||||||
limit: 1,
|
limit: 1,
|
||||||
|
paginate: true,
|
||||||
query: {},
|
query: {},
|
||||||
|
bookmark,
|
||||||
})
|
})
|
||||||
expect(response.rows).toEqual(rows)
|
bookmark = response.bookmark
|
||||||
}
|
hasNextPage = response.hasNextPage
|
||||||
|
expect(response.rows.length).toEqual(1)
|
||||||
|
const foundRow = response.rows[0]
|
||||||
|
expect(foundRow).toEqual(fullRowList[rowCount++])
|
||||||
|
} while (hasNextPage)
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue