Move empty object range tests out of sql.spec.ts.
This commit is contained in:
parent
8d6aaff45d
commit
9c9b2ff48d
2 changed files with 14 additions and 38 deletions
|
@ -712,6 +712,20 @@ describe.each([
|
|||
expectQuery({
|
||||
range: { name: { low: "g", high: "h" } },
|
||||
}).toFindNothing())
|
||||
|
||||
!isLucene &&
|
||||
it("ignores low if it's an empty object", () =>
|
||||
expectQuery({
|
||||
// @ts-ignore
|
||||
range: { name: { low: {}, high: "z" } },
|
||||
}).toContainExactly([{ name: "foo" }, { name: "bar" }]))
|
||||
|
||||
!isLucene &&
|
||||
it("ignores high if it's an empty object", () =>
|
||||
expectQuery({
|
||||
// @ts-ignore
|
||||
range: { name: { low: "a", high: {} } },
|
||||
}).toContainExactly([{ name: "foo" }, { name: "bar" }]))
|
||||
})
|
||||
|
||||
describe("empty", () => {
|
||||
|
|
|
@ -190,44 +190,6 @@ describe("SQL query builder", () => {
|
|||
})
|
||||
})
|
||||
|
||||
it("should ignore high range value if it is an empty object", () => {
|
||||
const query = sql._query(
|
||||
generateReadJson({
|
||||
filters: {
|
||||
range: {
|
||||
dob: {
|
||||
low: "2000-01-01 00:00:00",
|
||||
high: {},
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
)
|
||||
expect(query).toEqual({
|
||||
bindings: ["2000-01-01 00:00:00", 500],
|
||||
sql: `select * from (select * from "${TABLE_NAME}" where "${TABLE_NAME}"."dob" >= $1 limit $2) as "${TABLE_NAME}"`,
|
||||
})
|
||||
})
|
||||
|
||||
it("should ignore low range value if it is an empty object", () => {
|
||||
const query = sql._query(
|
||||
generateReadJson({
|
||||
filters: {
|
||||
range: {
|
||||
dob: {
|
||||
low: {},
|
||||
high: "2010-01-01 00:00:00",
|
||||
},
|
||||
},
|
||||
},
|
||||
})
|
||||
)
|
||||
expect(query).toEqual({
|
||||
bindings: ["2010-01-01 00:00:00", 500],
|
||||
sql: `select * from (select * from "${TABLE_NAME}" where "${TABLE_NAME}"."dob" <= $1 limit $2) as "${TABLE_NAME}"`,
|
||||
})
|
||||
})
|
||||
|
||||
it("should lowercase the values for Oracle LIKE statements", () => {
|
||||
let query = new Sql(SqlClient.ORACLE, limit)._query(
|
||||
generateReadJson({
|
||||
|
|
Loading…
Reference in a new issue