darvin-testing-framework
Advanced tools
Comparing version 1.13.0 to 1.13.1
90
index.js
@@ -20,62 +20,64 @@ 'use strict'; | ||
describe(specs, options) { | ||
if (!Array.isArray(specs)) { | ||
specs = [specs]; | ||
} | ||
describe("Spec root", () => { | ||
if (!Array.isArray(specs)) { | ||
specs = [specs]; | ||
} | ||
if (options && options.setup && typeof options.setup === 'function') { | ||
beforeAll(options.setup); | ||
} | ||
if (options && options.teardown && typeof options.teardown === 'function') { | ||
afterAll(options.teardown); | ||
} | ||
specs.forEach(spec => { | ||
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, () => { | ||
specs.forEach(spec => { | ||
if (!spec.name) { | ||
throw Error('Tried to execute a spec without a name.'); | ||
} | ||
if (spec.parameters) { | ||
this._validateParameters(spec.parameters); | ||
if (!spec.scenarios) { | ||
throw Error(`The spec '${spec.name}' does not have 'scenarios'.`); | ||
} | ||
spec.scenarios.forEach(scenario => { | ||
that._validateScenario(spec, scenario); | ||
const that = this; | ||
describe(spec.name, () => { | ||
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) | ||
}; | ||
if (spec.dynamic && typeof spec.dynamic === 'function') { | ||
const sender = this._getSender(); | ||
const context = { | ||
send: message => this._send(spec, sender, message) | ||
}; | ||
spec.dynamic(context); | ||
} | ||
spec.dynamic(context); | ||
} | ||
}); | ||
}); | ||
@@ -82,0 +84,0 @@ }); |
{ | ||
"name": "darvin-testing-framework", | ||
"version": "1.13.0", | ||
"version": "1.13.1", | ||
"description": "A framework for testing Kinvey Chat 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
22222
246