Getting create/update response consistent with internal API for external.
This commit is contained in:
parent
3dc7192113
commit
5a3ecc3095
|
@ -1787,19 +1787,14 @@ describe.each([
|
||||||
user: null,
|
user: null,
|
||||||
users: null,
|
users: null,
|
||||||
})
|
})
|
||||||
const toCompare: any = {
|
expect(updatedRow).toEqual({
|
||||||
name: rowData.name,
|
name: rowData.name,
|
||||||
description: rowData.description,
|
description: rowData.description,
|
||||||
tableId,
|
tableId,
|
||||||
_id: row._id,
|
_id: row._id,
|
||||||
_rev: expect.any(String),
|
_rev: expect.any(String),
|
||||||
type: "row",
|
type: "row",
|
||||||
}
|
})
|
||||||
if (!isInternal) {
|
|
||||||
toCompare.user = null
|
|
||||||
toCompare.users = null
|
|
||||||
}
|
|
||||||
expect(updatedRow).toEqual(toCompare)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
it("fetch all will populate the relationships", async () => {
|
it("fetch all will populate the relationships", async () => {
|
||||||
|
|
|
@ -250,6 +250,14 @@ export async function outputProcessing<T extends Row[] | Row>(
|
||||||
enriched
|
enriched
|
||||||
)) as Row[]
|
)) as Row[]
|
||||||
}
|
}
|
||||||
|
// remove null properties to match internal API
|
||||||
|
for (let row of enriched) {
|
||||||
|
for (let key of Object.keys(row)) {
|
||||||
|
if (row[key] === null) {
|
||||||
|
delete row[key]
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
return (wasArray ? enriched : enriched[0]) as T
|
return (wasArray ? enriched : enriched[0]) as T
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue