Merge pull request #13332 from Budibase/budi-8118-clear-relationships-if-empty-flag-doesnt-work-in-update-row

fix for boolean values getting stripped when running processObject
This commit is contained in:
Adria Navarro 2024-03-21 17:34:40 +01:00 committed by GitHub
commit 20af4a82e3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 21 additions and 1 deletions

View File

@ -94,7 +94,7 @@ export async function processObject<T extends Record<string, any>>(
for (const key of Object.keys(object || {})) {
if (object[key] != null) {
const val = object[key]
let parsedValue
let parsedValue = val
if (typeof val === "string") {
parsedValue = await processString(object[key], context, opts)
} else if (typeof val === "object") {

View File

@ -104,6 +104,26 @@ describe("Test that the object processing works correctly", () => {
}
expect(error).toBeNull()
})
it("should be able to handle booleans", async () => {
const output = await processObject(
{
first: true,
second: "true",
third: "another string",
forth: "with {{ template }}",
},
{
template: "value",
}
)
expect(output).toEqual({
first: true,
second: "true",
third: "another string",
forth: "with value",
})
})
})
describe("check returning objects", () => {