From a27c28ccdff8cf8b55b28d9c268642a33d571a30 Mon Sep 17 00:00:00 2001 From: mike12345567 Date: Tue, 26 Nov 2024 15:54:59 +0000 Subject: [PATCH] Fixing test case. --- packages/server/src/api/controllers/row/staticFormula.ts | 7 ++----- packages/server/src/api/routes/tests/row.spec.ts | 6 +++++- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/packages/server/src/api/controllers/row/staticFormula.ts b/packages/server/src/api/controllers/row/staticFormula.ts index 74a558e228..b9751b1ce2 100644 --- a/packages/server/src/api/controllers/row/staticFormula.ts +++ b/packages/server/src/api/controllers/row/staticFormula.ts @@ -15,7 +15,7 @@ import { } from "@budibase/types" import * as linkRows from "../../../db/linkedRows" import isEqual from "lodash/isEqual" -import { cloneDeep } from "lodash/fp" +import { cloneDeep, merge } from "lodash/fp" import sdk from "../../../sdk" import * as pro from "@budibase/pro" @@ -164,10 +164,7 @@ export async function finaliseRow( await db.put(row) const retrieved = await db.tryGet(row._id) - enrichedRow = { - ...enrichedRow, - ...retrieved, - } + enrichedRow = merge(retrieved, enrichedRow) enrichedRow = await processFormulas(table, enrichedRow, { dynamic: false, }) diff --git a/packages/server/src/api/routes/tests/row.spec.ts b/packages/server/src/api/routes/tests/row.spec.ts index c91be2b9ae..970e5f3619 100644 --- a/packages/server/src/api/routes/tests/row.spec.ts +++ b/packages/server/src/api/routes/tests/row.spec.ts @@ -85,7 +85,7 @@ function encodeJS(binding: string) { return `{{ js "${Buffer.from(binding).toString("base64")}"}}` } -const descriptions = datasourceDescribe({ exclude: [DatabaseName.MONGODB] }) +const descriptions = datasourceDescribe({ only: [DatabaseName.SQS] }) if (descriptions.length) { describe.each(descriptions)( @@ -2571,12 +2571,14 @@ if (descriptions.length) { let tableId: string let o2mData: Row[] let m2mData: Row[] + let isRelationship: boolean beforeAll(async () => { const table = await config.api.table.save( defaultTable({ schema: relSchema() }) ) tableId = table._id! + isRelationship = relSchema().user.type === FieldType.LINK o2mData = [ await dataGenerator(o2mTable._id!), @@ -2763,6 +2765,8 @@ if (descriptions.length) { type: isInternal ? "row" : undefined, createdAt: isInternal ? new Date().toISOString() : undefined, updatedAt: isInternal ? new Date().toISOString() : undefined, + users: isRelationship ? undefined : [], + user: isRelationship ? undefined : [], }) })