1
0
Fork 0
mirror of synced 2024-09-20 11:27:56 +12:00

Fix tests

This commit is contained in:
Adria Navarro 2024-07-23 10:02:37 +02:00
parent 3d57a64bab
commit cc77cea269

View file

@ -255,7 +255,7 @@ async function checkForWebhooks({ oldAuto, newAuto }: any) {
}
function trimUnexpectedObjectFields<T extends Automation>(automation: T): T {
const result: RequiredKeys<Automation> = {
const allRequired: RequiredKeys<Automation> = {
_id: automation._id,
_rev: automation._rev,
definition: automation.definition,
@ -271,5 +271,11 @@ function trimUnexpectedObjectFields<T extends Automation>(automation: T): T {
createdAt: automation.createdAt,
updatedAt: automation.updatedAt,
}
const result = { ...allRequired } as T
for (const key in result) {
if (!Object.prototype.hasOwnProperty.call(automation, key)) {
delete result[key]
}
}
return result as T
}