1
0
Fork 0
mirror of synced 2024-08-23 05:51:29 +12:00

Move sort stability check to search.spec.ts.

This commit is contained in:
Sam Rose 2024-05-21 14:20:05 +01:00
parent 9c9b2ff48d
commit bc63a11979
No known key found for this signature in database
2 changed files with 19 additions and 15 deletions

View file

@ -1309,6 +1309,25 @@ describe.each([
{ auto: 2 },
{ auto: 1 },
]))
// This is important for pagination. The order of results must always
// be stable or pagination will break. We don't want the user to need
// to specify an order for pagination to work.
it("is stable without a sort specified", async () => {
let { rows } = await config.api.row.search(table._id!, {
tableId: table._id!,
query: {},
})
for (let i = 0; i < 10; i++) {
const response = await config.api.row.search(table._id!, {
tableId: table._id!,
limit: 1,
query: {},
})
expect(response.rows).toEqual(rows)
}
})
})
// TODO(samwho): fix for SQS

View file

@ -235,21 +235,6 @@ describe("SQL query builder", () => {
})
})
it("should sort SQL Server tables by the primary key if no sort data is provided", () => {
let query = new Sql(SqlClient.MS_SQL, limit)._query(
generateReadJson({
sort: {},
paginate: {
limit: 10,
},
})
)
expect(query).toEqual({
bindings: [10],
sql: `select * from (select top (@p0) * from [test] order by [test].[id] asc) as [test]`,
})
})
it("should not parse JSON string as Date", () => {
let query = new Sql(SqlClient.POSTGRES, limit)._query(
generateCreateJson(TABLE_NAME, {