darvin-testing-framework
Advanced tools
Comparing version 1.2.0 to 1.3.0
18
index.js
@@ -10,3 +10,5 @@ 'use strict'; | ||
constructor(config) { | ||
config = config || { apiUrl: 'https://api.darvin.ai/' }; | ||
config = config || { | ||
apiUrl: 'https://api.darvin.ai/' | ||
}; | ||
this._apiUrl = config.apiUrl; | ||
@@ -40,3 +42,5 @@ } | ||
if (spec.dynamic && typeof spec.dynamic === 'function') { | ||
const sender = { id: 'tempuser-' + uuid() }; | ||
const sender = { | ||
id: 'tempuser-' + uuid() | ||
}; | ||
const context = { | ||
@@ -81,3 +85,5 @@ send: message => this._send(spec, sender, message) | ||
_executeStep(spec, scenario, step, sender) { | ||
const message = Object.assign({}, step.user, { mocks: Object.assign({}, scenario.mocks, step.mocks) }); | ||
const message = Object.assign({}, step.user, { | ||
mocks: Object.assign({}, scenario.mocks, step.mocks) | ||
}); | ||
return this._send(spec, sender, message) | ||
@@ -115,2 +121,8 @@ .then(response => this._verifyStep(step, response)); | ||
if (step.bot) { | ||
let index = response.findIndex(m => m.type === 'event'); | ||
while (index >= 0) { | ||
response.splice(index, 1); | ||
index = response.findIndex(m => m.type === 'event'); | ||
} | ||
expect(step.bot.map(JSON.stringify)).toContain(JSON.stringify(response)); | ||
@@ -117,0 +129,0 @@ } |
{ | ||
"name": "darvin-testing-framework", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "A framework for testing Darvin.ai bots.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121
13247
6