This commit is contained in:
Adria Navarro 2023-10-09 13:21:40 +02:00
parent a5477f14d2
commit d7aa23f740
1 changed files with 63 additions and 48 deletions

View File

@ -20,7 +20,21 @@ const tableWithUserCol: Table = {
},
}
describe("searchInputMapping", () => {
const tableWithUsersCol: Table = {
_id: tableId,
name: "table",
schema: {
user: {
name: "user",
type: FieldType.BB_REFERENCE,
subtype: FieldTypeSubtypes.BB_REFERENCE.USERS,
},
},
}
describe.each([tableWithUserCol, tableWithUsersCol])(
"searchInputMapping",
col => {
const globalUserId = dbCore.generateGlobalUserID()
const userMedataId = dbCore.generateUserMetadataID(globalUserId)
@ -33,7 +47,7 @@ describe("searchInputMapping", () => {
},
},
}
const output = searchInputMapping(tableWithUserCol, params)
const output = searchInputMapping(col, params)
expect(output.query.equal!["1:user"]).toBe(globalUserId)
})
@ -46,7 +60,7 @@ describe("searchInputMapping", () => {
},
},
}
const output = searchInputMapping(tableWithUserCol, params)
const output = searchInputMapping(col, params)
expect(output.query.oneOf!["1:user"]).toStrictEqual([
globalUserId,
globalUserId,
@ -63,7 +77,7 @@ describe("searchInputMapping", () => {
},
},
}
const output = searchInputMapping(tableWithUserCol, params)
const output = searchInputMapping(col, params)
expect(output.query.equal!["1:user"]).toBe(email)
})
@ -71,7 +85,8 @@ describe("searchInputMapping", () => {
const params: any = {
tableId,
}
const output = searchInputMapping(tableWithUserCol, params)
const output = searchInputMapping(col, params)
expect(output.query).toBeUndefined()
})
})
}
)