Fix tests.

This commit is contained in:
Sam Rose 2024-04-11 17:16:32 +01:00
parent 12fdaefe4c
commit a024a28de1
No known key found for this signature in database
1 changed files with 30 additions and 48 deletions

View File

@ -271,58 +271,40 @@ describe.each([
expectQuery({ expectQuery({
range: { age: { low: 5, high: 10 } }, range: { age: { low: 5, high: 10 } },
}).toContain([{ age: 10 }])) }).toContain([{ age: 10 }]))
})
describe("sort", () => { describe("sort", () => {
it("sorts ascending", () => it("sorts ascending", () =>
expectSearch({ expectSearch({
query: {}, query: {},
sort: "age", sort: "age",
sortOrder: SortOrder.ASCENDING, sortOrder: SortOrder.ASCENDING,
}).toMatch([{ age: 1 }, { age: 10 }])) }).toMatch([{ age: 1 }, { age: 10 }]))
it("sorts descending", () => it("sorts descending", () =>
expectSearch({ expectSearch({
query: {}, query: {},
sort: "age", sort: "age",
sortOrder: SortOrder.DESCENDING, sortOrder: SortOrder.DESCENDING,
}).toMatch([{ age: 10 }, { age: 1 }])) }).toMatch([{ age: 10 }, { age: 1 }]))
}) })
describe("sortType NUMBER", () => { describe("sortType NUMBER", () => {
it("sorts ascending", () => it("sorts ascending", () =>
expectSearch({ expectSearch({
query: {}, query: {},
sort: "age", sort: "age",
sortType: SortType.NUMBER, sortType: SortType.NUMBER,
sortOrder: SortOrder.ASCENDING, sortOrder: SortOrder.ASCENDING,
}).toMatch([{ age: 1 }, { age: 10 }])) }).toMatch([{ age: 1 }, { age: 10 }]))
it("sorts descending", () => it("sorts descending", () =>
expectSearch({ expectSearch({
query: {}, query: {},
sort: "age", sort: "age",
sortType: SortType.NUMBER, sortType: SortType.NUMBER,
sortOrder: SortOrder.DESCENDING, sortOrder: SortOrder.DESCENDING,
}).toMatch([{ age: 10 }, { age: 1 }])) }).toMatch([{ age: 10 }, { age: 1 }]))
})
describe("sortType STRING", () => {
it("sorts ascending", () =>
expectSearch({
query: {},
sort: "age",
sortType: SortType.STRING,
sortOrder: SortOrder.ASCENDING,
}).toMatch([{ age: 1 }, { age: 10 }]))
it("sorts descending", () =>
expectSearch({
query: {},
sort: "age",
sortType: SortType.STRING,
sortOrder: SortOrder.DESCENDING,
}).toMatch([{ age: 10 }, { age: 1 }]))
})
}) })
}) })