Socket
Socket
Sign inDemoInstall

darvin-testing-framework

Package Overview
Dependencies
Maintainers
1
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.3.0 to 1.4.0

36

index.js

@@ -18,3 +18,3 @@ 'use strict';

if (!spec.name) {
throw Error(`Tried to execute a spec without a name.`);
throw Error('Tried to execute a spec without a name.');
}

@@ -38,9 +38,16 @@

that._validateScenario(spec, scenario);
it(scenario.it, done => that._executeScenario(spec, scenario, done));
Object.keys(scenario).forEach(key => {
switch (key) {
case 'it':
it(scenario.it, done => that._executeScenario(spec, scenario, done));
break;
case 'fit':
fit(scenario.fit, done => that._executeScenario(spec, scenario, done));
break;
}
});
});
if (spec.dynamic && typeof spec.dynamic === 'function') {
const sender = {
id: 'tempuser-' + uuid()
};
const sender = this._getSender();
const context = {

@@ -56,8 +63,8 @@ send: message => this._send(spec, sender, message)

_validateScenario(spec, scenario) {
if (!scenario.it) {
throw Error(`The spec '${spec.name}' has a scenario without description in 'it'.`);
if (!scenario.it && !scenario.fit) {
throw Error(`The spec '${spec.name}' has a scenario without description in 'it' / 'fit'.`);
}
if (!scenario.steps) {
throw Error(`The spec '${spec.name}' has a scenario without 'steps' in it.`);
throw Error(`The spec '${spec.name}' has a scenario without 'steps'.`);
}

@@ -76,5 +83,3 @@ }

const that = this;
const sender = {
id: 'tempuser-' + uuid()
};
const sender = this._getSender(spec.sender);

@@ -86,2 +91,9 @@ BbPromise.each(scenario.steps, step => that._executeStep(spec, scenario, step, sender))

_getSender(sender) {
const name = sender && sender.name || 'test-user';
const id = `${sender && sender.id || name}-${sender && sender.uuid || uuid()}`;
return { id, name };
}
_executeStep(spec, scenario, step, sender) {

@@ -134,2 +146,2 @@ const message = Object.assign({}, step.user, {

module.exports = TestingFramework;
module.exports = TestingFramework;
{
"name": "darvin-testing-framework",
"version": "1.3.0",
"version": "1.4.0",
"description": "A framework for testing Darvin.ai bots.",

@@ -5,0 +5,0 @@ "main": "index.js",

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