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