Run tests for all

This commit is contained in:
Adria Navarro 2024-10-16 12:38:38 +02:00
parent 83ffee3194
commit 7266fb3c1b
2 changed files with 37 additions and 38 deletions

View File

@ -216,15 +216,15 @@ export async function search(ctx: Ctx<SearchRowRequest, SearchRowResponse>) {
await context.ensureSnippetContext(true)
let enrichedQuery: SearchFilters = await utils.enrichSearchContext(
{ ...ctx.request.body.query },
{
user: sdk.users.getUserContextBindings(ctx.user),
}
)
let { query } = ctx.request.body
if (!isPlainObject(query)) {
const allTables = await sdk.tables.getAllTables()
query = replaceTableNamesInFilters(tableId, query, allTables)
}
const allTables = await sdk.tables.getAllTables()
enrichedQuery = replaceTableNamesInFilters(tableId, enrichedQuery, allTables)
let enrichedQuery: SearchFilters = await utils.enrichSearchContext(query, {
user: sdk.users.getUserContextBindings(ctx.user),
})
const searchParams: RowSearchParams = {
...ctx.request.body,

View File

@ -2567,7 +2567,8 @@ describe.each([
expect(response.rows[0].productCat).toBeArrayOfSize(11)
})
})
;(isSqs || isLucene) &&
isSql &&
describe("relations to same table", () => {
let relatedTable: string, relatedRows: Row[]
@ -2637,38 +2638,36 @@ describe.each([
])
})
isSqs &&
it("should be able to filter via the first relation field with equal", async () => {
await expectSearch({
query: {
equal: {
["related1.name"]: "baz",
},
it("should be able to filter via the first relation field with equal", async () => {
await expectSearch({
query: {
equal: {
["related1.name"]: "baz",
},
}).toContainExactly([
{
name: "test2",
related1: [{ _id: relatedRows[2]._id }],
},
])
})
},
}).toContainExactly([
{
name: "test2",
related1: [{ _id: relatedRows[2]._id }],
},
])
})
isSqs &&
it("should be able to filter via the second relation field with not equal", async () => {
await expectSearch({
query: {
notEqual: {
["1:related2.name"]: "foo",
["2:related2.name"]: "baz",
["3:related2.name"]: "boo",
},
it("should be able to filter via the second relation field with not equal", async () => {
await expectSearch({
query: {
notEqual: {
["1:related2.name"]: "foo",
["2:related2.name"]: "baz",
["3:related2.name"]: "boo",
},
}).toContainExactly([
{
name: "test",
},
])
})
},
}).toContainExactly([
{
name: "test",
},
])
})
})
isInternal &&