Fix tests (breaking because of mutating objects...)

This commit is contained in:
Adria Navarro 2024-07-17 16:28:46 +02:00
parent 166d8fac5e
commit 812afdb85e
2 changed files with 4 additions and 7 deletions

View File

@ -267,8 +267,7 @@ describe("/automations", () => {
}
it("updates a automations name", async () => {
let automation = newAutomation()
await config.createAutomation(automation)
const automation = await config.createAutomation(newAutomation())
automation.name = "Updated Name"
jest.clearAllMocks()
@ -294,8 +293,7 @@ describe("/automations", () => {
})
it("updates a automations name using POST request", async () => {
let automation = newAutomation()
await config.createAutomation(automation)
const automation = await config.createAutomation(newAutomation())
automation.name = "Updated Name"
jest.clearAllMocks()
@ -392,8 +390,7 @@ describe("/automations", () => {
describe("fetch", () => {
it("return all the automations for an instance", async () => {
await clearAllAutomations(config)
const autoConfig = basicAutomation()
await config.createAutomation(autoConfig)
const autoConfig = await config.createAutomation(basicAutomation())
const res = await request
.get(`/api/automations`)
.set(config.defaultHeaders())

View File

@ -159,7 +159,7 @@ export function automationTrigger(
}
export function newAutomation({ steps, trigger }: any = {}) {
const automation: any = basicAutomation()
const automation = basicAutomation()
if (trigger) {
automation.definition.trigger = trigger