1
0
Fork 0
mirror of synced 2024-08-05 13:21:26 +12:00

Down to 4 failures.

This commit is contained in:
Sam Rose 2024-06-13 16:23:16 +01:00
parent 746ee711ae
commit c01c2c7cc3
No known key found for this signature in database
2 changed files with 315 additions and 296 deletions

View file

@ -313,7 +313,8 @@ describe.each([
})
})
// Ensure all bindings resolve and perform as expected
// We've decided not to try and support binding for in-memory search just now.
!isInMemory &&
describe("bindings", () => {
let globalUsers: any = []
@ -362,7 +363,10 @@ describe.each([
},
{
name: "deprecated multi user with session user",
deprecated_multi_user: JSON.stringify([...globalUsers, currentUser]),
deprecated_multi_user: JSON.stringify([
...globalUsers,
currentUser,
]),
},
]
}
@ -522,9 +526,11 @@ describe.each([
// TODO(samwho): fix for SQS
!isSqs &&
it("should match the session user id in a multi user field", async () => {
const allUsers = [...globalUsers, config.getUser()].map((user: any) => {
const allUsers = [...globalUsers, config.getUser()].map(
(user: any) => {
return { _id: user._id }
})
}
)
await expectQuery({
contains: { multi_user: ["{{ [user]._id }}"] },
@ -539,9 +545,11 @@ describe.each([
// TODO(samwho): fix for SQS
!isSqs &&
it("should match the session user id in a deprecated multi user field", async () => {
const allUsers = [...globalUsers, config.getUser()].map((user: any) => {
const allUsers = [...globalUsers, config.getUser()].map(
(user: any) => {
return { _id: user._id }
})
}
)
await expectQuery({
contains: { deprecated_multi_user: ["{{ [user]._id }}"] },

View file

@ -325,17 +325,28 @@ export const runQuery = (
return false
}
if (_.isObject(testValue.low) && _.isEmpty(testValue.low)) {
testValue.low = undefined
}
if (_.isObject(testValue.high) && _.isEmpty(testValue.high)) {
testValue.high = undefined
}
if (testValue.low == null && testValue.high == null) {
return false
}
if (!isNaN(+docValue)) {
if (!isNaN(+testValue.low) && !isNaN(+testValue.high)) {
return +docValue >= testValue.low && +docValue <= testValue.high
} else if (!isNaN(+testValue.low)) {
return +docValue >= testValue.low
} else if (!isNaN(+testValue.high)) {
return +docValue <= testValue.high
const docNum = +docValue
if (!isNaN(docNum)) {
const lowNum = +testValue.low
const highNum = +testValue.high
if (!isNaN(lowNum) && !isNaN(highNum)) {
return docNum >= lowNum && docNum <= highNum
} else if (!isNaN(lowNum)) {
return docNum >= lowNum
} else if (!isNaN(highNum)) {
return docNum <= highNum
}
}