Testing
This commit is contained in:
parent
a5477f14d2
commit
d7aa23f740
|
@ -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 globalUserId = dbCore.generateGlobalUserID()
|
||||||
const userMedataId = dbCore.generateUserMetadataID(globalUserId)
|
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)
|
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([
|
expect(output.query.oneOf!["1:user"]).toStrictEqual([
|
||||||
globalUserId,
|
globalUserId,
|
||||||
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)
|
expect(output.query.equal!["1:user"]).toBe(email)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -71,7 +85,8 @@ describe("searchInputMapping", () => {
|
||||||
const params: any = {
|
const params: any = {
|
||||||
tableId,
|
tableId,
|
||||||
}
|
}
|
||||||
const output = searchInputMapping(tableWithUserCol, params)
|
const output = searchInputMapping(col, params)
|
||||||
expect(output.query).toBeUndefined()
|
expect(output.query).toBeUndefined()
|
||||||
})
|
})
|
||||||
})
|
}
|
||||||
|
)
|
||||||
|
|
Loading…
Reference in New Issue