Fix tests

This commit is contained in:
Adria Navarro 2023-09-29 16:39:18 +02:00
parent 7050c5352a
commit 1a00b60088
3 changed files with 3 additions and 6 deletions

View File

@ -48,7 +48,7 @@ export async function processOutputBBReferences(
) {
if (typeof value !== "string") {
// Already processed or nothing to process
return value
return value || undefined
}
const ids = value.split(",").filter(id => !!id)

View File

@ -235,9 +235,6 @@ export async function outputProcessing<T extends Row[] | Row>(
}
} else if (column.type == FieldTypes.BB_REFERENCE) {
for (let row of enriched) {
if (row[property] == null) {
continue
}
row[property] = await processOutputBBReferences(
row[property],
column.subtype as FieldSubtype

View File

@ -66,7 +66,7 @@ describe("rowProcessor - outputProcessing", () => {
)
})
it("does not fetch bb references when fields are empty", async () => {
it("process output even when the field is not empty", async () => {
const table: Table = {
_id: generator.guid(),
name: "TestTable",
@ -100,7 +100,7 @@ describe("rowProcessor - outputProcessing", () => {
expect(result).toEqual({ name: "Jack" })
expect(bbReferenceProcessor.processOutputBBReferences).not.toBeCalled()
expect(bbReferenceProcessor.processOutputBBReferences).toBeCalledTimes(1)
})
it("does not fetch bb references when not in the schema", async () => {