Merge pull request #13450 from Budibase/more-sqs-tests
Get date search tests passing for SQS.
This commit is contained in:
commit
2413d34c3a
|
@ -83,9 +83,6 @@ describe.each([
|
||||||
{ query: { equal: { name: "foo" } }, expected: [rows[0]] },
|
{ query: { equal: { name: "foo" } }, expected: [rows[0]] },
|
||||||
{ query: { notEqual: { name: "foo" } }, expected: [rows[1]] },
|
{ query: { notEqual: { name: "foo" } }, expected: [rows[1]] },
|
||||||
{ query: { oneOf: { name: ["foo"] } }, expected: [rows[0]] },
|
{ query: { oneOf: { name: ["foo"] } }, expected: [rows[0]] },
|
||||||
// { query: { contains: { name: "f" } }, expected: [0] },
|
|
||||||
// { query: { notContains: { name: ["f"] } }, expected: [1] },
|
|
||||||
// { query: { containsAny: { name: ["f"] } }, expected: [0] },
|
|
||||||
]
|
]
|
||||||
|
|
||||||
it.each(stringSearchTests)(
|
it.each(stringSearchTests)(
|
||||||
|
@ -186,8 +183,8 @@ describe.each([
|
||||||
})
|
})
|
||||||
|
|
||||||
const rows = [
|
const rows = [
|
||||||
{ dob: new Date("2020-01-01") },
|
{ dob: new Date("2020-01-01").toISOString() },
|
||||||
{ dob: new Date("2020-01-10") },
|
{ dob: new Date("2020-01-10").toISOString() },
|
||||||
]
|
]
|
||||||
|
|
||||||
interface DateSearchTest {
|
interface DateSearchTest {
|
||||||
|
@ -206,16 +203,19 @@ describe.each([
|
||||||
expected: [],
|
expected: [],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
query: { equal: { dob: new Date("2020-01-01") } },
|
query: { equal: { dob: new Date("2020-01-01").toISOString() } },
|
||||||
expected: [rows[0]],
|
expected: [rows[0]],
|
||||||
},
|
},
|
||||||
{ query: { equal: { dob: new Date("2020-01-02") } }, expected: [] },
|
|
||||||
{
|
{
|
||||||
query: { notEqual: { dob: new Date("2020-01-01") } },
|
query: { equal: { dob: new Date("2020-01-02").toISOString() } },
|
||||||
|
expected: [],
|
||||||
|
},
|
||||||
|
{
|
||||||
|
query: { notEqual: { dob: new Date("2020-01-01").toISOString() } },
|
||||||
expected: [rows[1]],
|
expected: [rows[1]],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
query: { oneOf: { dob: [new Date("2020-01-01")] } },
|
query: { oneOf: { dob: [new Date("2020-01-01").toISOString()] } },
|
||||||
expected: [rows[0]],
|
expected: [rows[0]],
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -256,10 +256,6 @@ describe.each([
|
||||||
it.each(dateSearchTests)(
|
it.each(dateSearchTests)(
|
||||||
`should be able to run query: $query`,
|
`should be able to run query: $query`,
|
||||||
async ({ query, expected }) => {
|
async ({ query, expected }) => {
|
||||||
// TODO(samwho): most of these work for SQS, but not all. Fix 'em.
|
|
||||||
if (isSqs) {
|
|
||||||
return
|
|
||||||
}
|
|
||||||
const savedRows = await Promise.all(
|
const savedRows = await Promise.all(
|
||||||
rows.map(r => config.api.row.save(table._id!, r))
|
rows.map(r => config.api.row.save(table._id!, r))
|
||||||
)
|
)
|
||||||
|
@ -270,9 +266,7 @@ describe.each([
|
||||||
expect(foundRows).toEqual(
|
expect(foundRows).toEqual(
|
||||||
expect.arrayContaining(
|
expect.arrayContaining(
|
||||||
expected.map(r =>
|
expected.map(r =>
|
||||||
expect.objectContaining(
|
expect.objectContaining(savedRows.find(sr => sr.dob === r.dob)!)
|
||||||
savedRows.find(sr => sr.dob === r.dob.toISOString())!
|
|
||||||
)
|
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue