Create search cross product on whether we save/search with timestamp.
This commit is contained in:
parent
26c0861e68
commit
7ad5879c3e
|
@ -1684,10 +1684,23 @@ if (descriptions.length) {
|
||||||
})
|
})
|
||||||
|
|
||||||
describe.only("datetime - date only", () => {
|
describe.only("datetime - date only", () => {
|
||||||
const JAN_1ST = "2020-01-01"
|
describe.each([true, false])(
|
||||||
const JAN_10TH = "2020-01-10"
|
"saved with timestamp: %s",
|
||||||
const JAN_30TH = "2020-01-30"
|
saveWithTimestamp => {
|
||||||
const UNEXISTING_DATE = "2020-01-03"
|
describe.each([true, false])(
|
||||||
|
"search with timestamp: %s",
|
||||||
|
searchWithTimestamp => {
|
||||||
|
const SAVE_SUFFIX = saveWithTimestamp
|
||||||
|
? "T00:00:00.000Z"
|
||||||
|
: ""
|
||||||
|
const SEARCH_SUFFIX = searchWithTimestamp
|
||||||
|
? "T00:00:00.000Z"
|
||||||
|
: ""
|
||||||
|
|
||||||
|
const JAN_1ST = `2020-01-01`
|
||||||
|
const JAN_10TH = `2020-01-10`
|
||||||
|
const JAN_30TH = `2020-01-30`
|
||||||
|
const UNEXISTING_DATE = `2020-01-03`
|
||||||
const NULL_DATE__ID = `null_date__id`
|
const NULL_DATE__ID = `null_date__id`
|
||||||
|
|
||||||
beforeAll(async () => {
|
beforeAll(async () => {
|
||||||
|
@ -1702,33 +1715,35 @@ if (descriptions.length) {
|
||||||
|
|
||||||
await createRows([
|
await createRows([
|
||||||
{ dateid: NULL_DATE__ID, date: null },
|
{ dateid: NULL_DATE__ID, date: null },
|
||||||
{ date: JAN_1ST },
|
{ date: `${JAN_1ST}${SAVE_SUFFIX}` },
|
||||||
{ date: `${JAN_10TH}T00:00:00.000Z` },
|
{ date: `${JAN_10TH}${SAVE_SUFFIX}` },
|
||||||
])
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
describe("equal", () => {
|
describe("equal", () => {
|
||||||
it("successfully finds a row", async () => {
|
it("successfully finds a row", async () => {
|
||||||
await expectQuery({
|
await expectQuery({
|
||||||
equal: { date: JAN_1ST },
|
equal: { date: `${JAN_1ST}${SEARCH_SUFFIX}` },
|
||||||
}).toContainExactly([{ date: JAN_1ST }])
|
}).toContainExactly([{ date: JAN_1ST }])
|
||||||
})
|
})
|
||||||
|
|
||||||
it("successfully finds an ISO8601 row", async () => {
|
it("successfully finds an ISO8601 row", async () => {
|
||||||
await expectQuery({
|
await expectQuery({
|
||||||
equal: { date: JAN_10TH },
|
equal: { date: `${JAN_10TH}${SEARCH_SUFFIX}` },
|
||||||
}).toContainExactly([{ date: JAN_10TH }])
|
}).toContainExactly([{ date: JAN_10TH }])
|
||||||
})
|
})
|
||||||
|
|
||||||
it("finds a row with ISO8601 timestamp", async () => {
|
it("finds a row with ISO8601 timestamp", async () => {
|
||||||
await expectQuery({
|
await expectQuery({
|
||||||
equal: { date: `${JAN_1ST}T00:00:00.000Z` },
|
equal: { date: `${JAN_1ST}${SEARCH_SUFFIX}` },
|
||||||
}).toContainExactly([{ date: JAN_1ST }])
|
}).toContainExactly([{ date: JAN_1ST }])
|
||||||
})
|
})
|
||||||
|
|
||||||
it("fails to find nonexistent row", async () => {
|
it("fails to find nonexistent row", async () => {
|
||||||
await expectQuery({
|
await expectQuery({
|
||||||
equal: { date: UNEXISTING_DATE },
|
equal: {
|
||||||
|
date: `${UNEXISTING_DATE}${SEARCH_SUFFIX}`,
|
||||||
|
},
|
||||||
}).toFindNothing()
|
}).toFindNothing()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -1736,7 +1751,7 @@ if (descriptions.length) {
|
||||||
describe("notEqual", () => {
|
describe("notEqual", () => {
|
||||||
it("successfully finds a row", async () => {
|
it("successfully finds a row", async () => {
|
||||||
await expectQuery({
|
await expectQuery({
|
||||||
notEqual: { date: JAN_1ST },
|
notEqual: { date: `${JAN_1ST}${SEARCH_SUFFIX}` },
|
||||||
}).toContainExactly([
|
}).toContainExactly([
|
||||||
{ date: JAN_10TH },
|
{ date: JAN_10TH },
|
||||||
{ dateid: NULL_DATE__ID },
|
{ dateid: NULL_DATE__ID },
|
||||||
|
@ -1745,7 +1760,7 @@ if (descriptions.length) {
|
||||||
|
|
||||||
it("fails to find nonexistent row", async () => {
|
it("fails to find nonexistent row", async () => {
|
||||||
await expectQuery({
|
await expectQuery({
|
||||||
notEqual: { date: JAN_30TH },
|
notEqual: { date: `${JAN_30TH}${SEARCH_SUFFIX}` },
|
||||||
}).toContainExactly([
|
}).toContainExactly([
|
||||||
{ date: JAN_1ST },
|
{ date: JAN_1ST },
|
||||||
{ date: JAN_10TH },
|
{ date: JAN_10TH },
|
||||||
|
@ -1757,13 +1772,15 @@ if (descriptions.length) {
|
||||||
describe("oneOf", () => {
|
describe("oneOf", () => {
|
||||||
it("successfully finds a row", async () => {
|
it("successfully finds a row", async () => {
|
||||||
await expectQuery({
|
await expectQuery({
|
||||||
oneOf: { date: [JAN_1ST] },
|
oneOf: { date: [`${JAN_1ST}${SEARCH_SUFFIX}`] },
|
||||||
}).toContainExactly([{ date: JAN_1ST }])
|
}).toContainExactly([{ date: JAN_1ST }])
|
||||||
})
|
})
|
||||||
|
|
||||||
it("fails to find nonexistent row", async () => {
|
it("fails to find nonexistent row", async () => {
|
||||||
await expectQuery({
|
await expectQuery({
|
||||||
oneOf: { date: [UNEXISTING_DATE] },
|
oneOf: {
|
||||||
|
date: [`${UNEXISTING_DATE}${SEARCH_SUFFIX}`],
|
||||||
|
},
|
||||||
}).toFindNothing()
|
}).toFindNothing()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
@ -1771,22 +1788,44 @@ if (descriptions.length) {
|
||||||
describe("range", () => {
|
describe("range", () => {
|
||||||
it("successfully finds a row", async () => {
|
it("successfully finds a row", async () => {
|
||||||
await expectQuery({
|
await expectQuery({
|
||||||
range: { date: { low: JAN_1ST, high: JAN_1ST } },
|
range: {
|
||||||
|
date: {
|
||||||
|
low: `${JAN_1ST}${SEARCH_SUFFIX}`,
|
||||||
|
high: `${JAN_1ST}${SEARCH_SUFFIX}`,
|
||||||
|
},
|
||||||
|
},
|
||||||
}).toContainExactly([{ date: JAN_1ST }])
|
}).toContainExactly([{ date: JAN_1ST }])
|
||||||
})
|
})
|
||||||
|
|
||||||
it("successfully finds multiple rows", async () => {
|
it("successfully finds multiple rows", async () => {
|
||||||
await expectQuery({
|
await expectQuery({
|
||||||
range: { date: { low: JAN_1ST, high: JAN_10TH } },
|
range: {
|
||||||
}).toContainExactly([{ date: JAN_1ST }, { date: JAN_10TH }])
|
date: {
|
||||||
|
low: `${JAN_1ST}${SEARCH_SUFFIX}`,
|
||||||
|
high: `${JAN_10TH}${SEARCH_SUFFIX}`,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
}).toContainExactly([
|
||||||
|
{ date: JAN_1ST },
|
||||||
|
{ date: JAN_10TH },
|
||||||
|
])
|
||||||
})
|
})
|
||||||
|
|
||||||
it("successfully finds no rows", async () => {
|
it("successfully finds no rows", async () => {
|
||||||
await expectQuery({
|
await expectQuery({
|
||||||
range: { date: { low: JAN_30TH, high: JAN_30TH } },
|
range: {
|
||||||
|
date: {
|
||||||
|
low: `${JAN_30TH}${SEARCH_SUFFIX}`,
|
||||||
|
high: `${JAN_30TH}${SEARCH_SUFFIX}`,
|
||||||
|
},
|
||||||
|
},
|
||||||
}).toFindNothing()
|
}).toFindNothing()
|
||||||
})
|
})
|
||||||
})
|
})
|
||||||
|
}
|
||||||
|
)
|
||||||
|
}
|
||||||
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
isInternal &&
|
isInternal &&
|
||||||
|
|
Loading…
Reference in New Issue