Browse Source

Some more test case fixes.

pull/662/head
mike12345567 6 years ago
parent
commit
e0e1cd7316
  1. 25
      packages/server/src/api/controllers/instance.js
  2. 6
      packages/server/src/api/routes/tests/automation.spec.js

25
packages/server/src/api/controllers/instance.js

@ -18,30 +18,7 @@ exports.create = async function(ctx) {
clientId,
applicationId: appId,
},
views: {
by_username: {
map: function(doc) {
if (doc.type === "user") {
emit([doc.username], doc._id)
}
}.toString(),
},
by_type: {
map: function(doc) {
emit([doc.type], doc._id)
}.toString(),
},
by_automation_trigger: {
map: function(doc) {
if (doc.type === "automation") {
const trigger = doc.definition.trigger
if (trigger) {
emit([trigger.event], trigger)
}
}
}.toString(),
},
},
views: {},
})
// Add the new instance under the app clientDB

6
packages/server/src/api/routes/tests/automation.spec.js

@ -10,12 +10,14 @@ const {
destroyDocument,
builderEndpointShouldBlockNormalUsers
} = require("./couchTestUtils")
let { generateAutomationID } = require("../../../db/utils")
const { delay } = require("./testUtils")
const MAX_RETRIES = 4
const AUTOMATION_ID = generateAutomationID()
const TEST_AUTOMATION = {
_id: "Test Automation",
_id: AUTOMATION_ID,
name: "My Automation",
pageId: "123123123",
screenId: "kasdkfldsafkl",
@ -206,7 +208,7 @@ describe("/automations", () => {
.expect('Content-Type', /json/)
.expect(200)
expect(res.body.message).toEqual("Automation Test Automation updated successfully.")
expect(res.body.message).toEqual(`Automation ${AUTOMATION_ID} updated successfully.`)
expect(res.body.automation.name).toEqual("Updated Name")
})
})

Loading…
Cancel
Save