Move sort stability check to search.spec.ts.
This commit is contained in:
parent
9c9b2ff48d
commit
bc63a11979
|
@ -1309,6 +1309,25 @@ describe.each([
|
||||||
{ auto: 2 },
|
{ auto: 2 },
|
||||||
{ auto: 1 },
|
{ 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
|
// TODO(samwho): fix for SQS
|
||||||
|
|
|
@ -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", () => {
|
it("should not parse JSON string as Date", () => {
|
||||||
let query = new Sql(SqlClient.POSTGRES, limit)._query(
|
let query = new Sql(SqlClient.POSTGRES, limit)._query(
|
||||||
generateCreateJson(TABLE_NAME, {
|
generateCreateJson(TABLE_NAME, {
|
||||||
|
|
Loading…
Reference in New Issue