Socket
Socket
Sign inDemoInstall

darvin-testing-framework

Package Overview
Dependencies
Maintainers
5
Versions
29
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

darvin-testing-framework - npm Package Compare versions

Comparing version 1.8.1 to 1.10.0

29

index.js

@@ -131,10 +131,11 @@ 'use strict';

message = this._formatMessage(message, scenario.parameters);
const context = Object.assign({}, scenario.parameters, { spec });
message = this._formatMessage(message, context);
return this._send(spec, sender, message)
.then(response => this._verifyStep(step, response, scenario.parameters));
.then(response => this._verifyStep(step, response, context));
}
_send(spec, sender, message) {
const channelUrl = `${this._apiUrl}v1/bots/${spec.botId}/channels/${spec.channel.id}/darvin`;
const channelUrl = `${this._apiUrl}v1/bots/${spec.proxyBotId || spec.botId}/channels/${spec.channel.id}/darvin`;
const payload = {

@@ -211,9 +212,23 @@ sender,

switch (key) {
case 'text':
case 'text': {
const expectedText = expectedResponse.text;
if (Array.isArray(expectedText)) {
return expectedText.includes(actualResponse.text);
} else {
return expectedText === actualResponse.text;
}
return expectedText === actualResponse.text;
}
case 'textStartsWith': {
const expectedText = expectedResponse.textStartsWith;
return actualResponse.text.startsWith(expectedText);
}
case 'textIncludes': {
const expectedText = expectedResponse.textContains;
if (Array.isArray(expectedText)) {
return expectedText.reduce((accumulator, currentValue) => accumulator && actualResponse.text.includes(currentValue));
}
return actualResponse.text.includes(expectedText);
}
case 'template':

@@ -223,3 +238,3 @@ return this._verify(expectedResponse.template, actualResponse.template, this._verifyTemplate.bind(this));

return JSON.stringify(expectedResponse[key]) === JSON.stringify(actualResponse[key]);
};
}
}

@@ -226,0 +241,0 @@

{
"name": "darvin-testing-framework",
"version": "1.8.1",
"description": "A framework for testing Darvin.ai bots.",
"version": "1.10.0",
"description": "A framework for testing Kinvey Chat bots.",
"main": "index.js",

@@ -6,0 +6,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc