Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

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.11.0 to 1.13.0

89

index.js

@@ -19,57 +19,64 @@ 'use strict';

describe(spec, options) {
describe(specs, options) {
if (!Array.isArray(specs)) {
specs = [specs];
}
if (!spec.name) {
throw Error('Tried to execute a spec without a name.');
if (options && options.setup && typeof options.setup === 'function') {
beforeAll(options.setup);
}
if (!spec.scenarios) {
throw Error(`The spec '${spec.name}' does not have 'scenarios'.`);
if (options && options.teardown && typeof options.teardown === 'function') {
afterAll(options.teardown);
}
const that = this;
describe(spec.name, () => {
if (options && options.setup && typeof options.setup === 'function') {
beforeAll(options.setup);
specs.forEach(spec => {
if (!spec.name) {
throw Error('Tried to execute a spec without a name.');
}
if (options && options.teardown && typeof options.teardown === 'function') {
afterAll(options.teardown);
if (!spec.scenarios) {
throw Error(`The spec '${spec.name}' does not have 'scenarios'.`);
}
if (spec.parameters) {
this._validateParameters(spec.parameters);
}
const that = this;
describe(spec.name, () => {
spec.scenarios.forEach(scenario => {
that._validateScenario(spec, scenario);
if (scenario.parameters) {
this._validateParameters(scenario.parameters);
Object.assign(scenario.parameters, parameters);
if (spec.parameters) {
this._validateParameters(spec.parameters);
}
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;
case 'xit':
xit(scenario.xit, done => that._executeScenario(spec, scenario, done));
break;
spec.scenarios.forEach(scenario => {
that._validateScenario(spec, scenario);
if (scenario.parameters) {
this._validateParameters(scenario.parameters);
Object.assign(scenario.parameters, parameters);
}
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;
case 'xit':
xit(scenario.xit, done => that._executeScenario(spec, scenario, done));
break;
}
});
});
});
if (spec.dynamic && typeof spec.dynamic === 'function') {
const sender = this._getSender();
const context = {
send: message => this._send(spec, sender, message)
};
spec.dynamic(context);
}
if (spec.dynamic && typeof spec.dynamic === 'function') {
const sender = this._getSender();
const context = {
send: message => this._send(spec, sender, message)
};
spec.dynamic(context);
}
});
});

@@ -111,3 +118,2 @@ }

const sender = this._getSender(spec.sender);
BbPromise.each(scenario.steps, step => that._executeStep(spec, scenario, step, sender))

@@ -121,3 +127,2 @@ .then(done)

const id = `${sender && sender.id || name}-${sender && sender.uuid || uuid()}`;
return {

@@ -229,3 +234,3 @@ id,

case 'textIncludes': {
const expectedText = expectedResponse.textContains;
const expectedText = expectedResponse.textIncludes;
if (Array.isArray(expectedText)) {

@@ -232,0 +237,0 @@ return expectedText.reduce((accumulator, currentValue) => accumulator && actualResponse.text.includes(currentValue));

{
"name": "darvin-testing-framework",
"version": "1.11.0",
"version": "1.13.0",
"description": "A framework for testing Kinvey Chat 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