Fix tests
This commit is contained in:
parent
3d57a64bab
commit
cc77cea269
|
@ -255,7 +255,7 @@ async function checkForWebhooks({ oldAuto, newAuto }: any) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function trimUnexpectedObjectFields<T extends Automation>(automation: T): T {
|
function trimUnexpectedObjectFields<T extends Automation>(automation: T): T {
|
||||||
const result: RequiredKeys<Automation> = {
|
const allRequired: RequiredKeys<Automation> = {
|
||||||
_id: automation._id,
|
_id: automation._id,
|
||||||
_rev: automation._rev,
|
_rev: automation._rev,
|
||||||
definition: automation.definition,
|
definition: automation.definition,
|
||||||
|
@ -271,5 +271,11 @@ function trimUnexpectedObjectFields<T extends Automation>(automation: T): T {
|
||||||
createdAt: automation.createdAt,
|
createdAt: automation.createdAt,
|
||||||
updatedAt: automation.updatedAt,
|
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
|
return result as T
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue