This commit is contained in:
Adria Navarro 2024-08-27 17:02:19 +02:00
parent 1594fcc8c4
commit 935aa521ff
1 changed files with 76 additions and 65 deletions

View File

@ -2442,7 +2442,13 @@ describe.each([
let auxData: Row[] = []
let flagCleanup: (() => void) | undefined
beforeAll(async () => {
flagCleanup = setCoreEnv({
TENANT_FEATURE_FLAGS: `*:${FeatureFlag.ENRICHED_RELATIONSHIPS}`,
})
const aux2Table = await config.api.table.save(saveTableRequest())
const aux2Data = await config.api.row.save(aux2Table._id!, {})
@ -2564,6 +2570,10 @@ describe.each([
tableId = table._id!
})
afterAll(() => {
flagCleanup?.()
})
const testScenarios: [string, (row: Row) => Promise<Row> | Row][] = [
["get row", (row: Row) => config.api.row.get(tableId, row._id!)],
[
@ -2603,11 +2613,7 @@ describe.each([
"can retrieve rows with populated relationships (via %s)",
async (__, retrieveDelegate) => {
const otherRows = _.sampleSize(auxData, 5)
await withCoreEnv(
{
TENANT_FEATURE_FLAGS: `*:${FeatureFlag.ENRICHED_RELATIONSHIPS}`,
},
async () => {
const row = await config.api.row.save(tableId, {
title: generator.word(),
relWithNoSchema: [otherRows[0]],
@ -2661,12 +2667,15 @@ describe.each([
)
}
)
}
)
it.each(testScenarios)(
"does not enrich relationships when not enabled (via %s)",
async (__, retrieveDelegate) => {
await withCoreEnv(
{
TENANT_FEATURE_FLAGS: ``,
},
async () => {
const otherRows = _.sampleSize(auxData, 5)
const row = await config.api.row.save(tableId, {
@ -2717,6 +2726,8 @@ describe.each([
)
}
)
}
)
})
describe("Formula fields", () => {