Fix tests (breaking because of mutating objects...)
This commit is contained in:
parent
166d8fac5e
commit
812afdb85e
|
@ -267,8 +267,7 @@ describe("/automations", () => {
|
||||||
}
|
}
|
||||||
|
|
||||||
it("updates a automations name", async () => {
|
it("updates a automations name", async () => {
|
||||||
let automation = newAutomation()
|
const automation = await config.createAutomation(newAutomation())
|
||||||
await config.createAutomation(automation)
|
|
||||||
automation.name = "Updated Name"
|
automation.name = "Updated Name"
|
||||||
jest.clearAllMocks()
|
jest.clearAllMocks()
|
||||||
|
|
||||||
|
@ -294,8 +293,7 @@ describe("/automations", () => {
|
||||||
})
|
})
|
||||||
|
|
||||||
it("updates a automations name using POST request", async () => {
|
it("updates a automations name using POST request", async () => {
|
||||||
let automation = newAutomation()
|
const automation = await config.createAutomation(newAutomation())
|
||||||
await config.createAutomation(automation)
|
|
||||||
automation.name = "Updated Name"
|
automation.name = "Updated Name"
|
||||||
jest.clearAllMocks()
|
jest.clearAllMocks()
|
||||||
|
|
||||||
|
@ -392,8 +390,7 @@ describe("/automations", () => {
|
||||||
describe("fetch", () => {
|
describe("fetch", () => {
|
||||||
it("return all the automations for an instance", async () => {
|
it("return all the automations for an instance", async () => {
|
||||||
await clearAllAutomations(config)
|
await clearAllAutomations(config)
|
||||||
const autoConfig = basicAutomation()
|
const autoConfig = await config.createAutomation(basicAutomation())
|
||||||
await config.createAutomation(autoConfig)
|
|
||||||
const res = await request
|
const res = await request
|
||||||
.get(`/api/automations`)
|
.get(`/api/automations`)
|
||||||
.set(config.defaultHeaders())
|
.set(config.defaultHeaders())
|
||||||
|
|
|
@ -159,7 +159,7 @@ export function automationTrigger(
|
||||||
}
|
}
|
||||||
|
|
||||||
export function newAutomation({ steps, trigger }: any = {}) {
|
export function newAutomation({ steps, trigger }: any = {}) {
|
||||||
const automation: any = basicAutomation()
|
const automation = basicAutomation()
|
||||||
|
|
||||||
if (trigger) {
|
if (trigger) {
|
||||||
automation.definition.trigger = trigger
|
automation.definition.trigger = trigger
|
||||||
|
|
Loading…
Reference in New Issue