darvin-testing-framework
Advanced tools
Comparing version 2.1.4 to 2.1.5-dev
93
index.js
@@ -21,3 +21,3 @@ 'use strict'; | ||
options = options || {}; | ||
options.rootDescribeName = options.rootDescribeName || "Spec root"; | ||
options.rootDescribeName = options.rootDescribeName || 'Spec root'; | ||
describe(options.rootDescribeName, () => { | ||
@@ -57,3 +57,2 @@ if (!Array.isArray(specs)) { | ||
this._validateParameters(scenario.parameters); | ||
Object.assign(scenario.parameters, parameters); | ||
} | ||
@@ -63,11 +62,11 @@ | ||
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; | ||
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; | ||
} | ||
@@ -94,3 +93,3 @@ }); | ||
if (typeof parameters[parameter] !== 'string') { | ||
throw Error(`Only string parameters are allowed, the invalid parameter is "${parameter}".`) | ||
throw Error(`Only string parameters are allowed, the invalid parameter is "${parameter}".`); | ||
} | ||
@@ -228,28 +227,28 @@ }); | ||
switch (key) { | ||
case 'text': { | ||
const expectedText = expectedResponse.text; | ||
if (Array.isArray(expectedText)) { | ||
return expectedText.includes(actualResponse.text); | ||
} | ||
return expectedText === actualResponse.text; | ||
case 'text': { | ||
const expectedText = expectedResponse.text; | ||
if (Array.isArray(expectedText)) { | ||
return expectedText.includes(actualResponse.text); | ||
} | ||
case 'textStartsWith': { | ||
const expectedText = expectedResponse.textStartsWith; | ||
return actualResponse.text.startsWith(expectedText); | ||
return expectedText === actualResponse.text; | ||
} | ||
case 'textStartsWith': { | ||
const expectedText = expectedResponse.textStartsWith; | ||
return actualResponse.text.startsWith(expectedText); | ||
} | ||
case 'textIncludes': { | ||
const expectedText = expectedResponse.textIncludes; | ||
if (Array.isArray(expectedText)) { | ||
return expectedText.reduce((accumulator, currentValue) => accumulator && actualResponse.text.includes(currentValue)); | ||
} | ||
case 'textIncludes': { | ||
const expectedText = expectedResponse.textIncludes; | ||
if (Array.isArray(expectedText)) { | ||
return expectedText.reduce((accumulator, currentValue) => accumulator && actualResponse.text.includes(currentValue)); | ||
} | ||
return actualResponse.text.includes(expectedText); | ||
} | ||
case 'template': | ||
return this._verify(expectedResponse.template, actualResponse.template, this._verifyTemplate.bind(this)); | ||
default: | ||
return JSON.stringify(expectedResponse[key]) === JSON.stringify(actualResponse[key]); | ||
return actualResponse.text.includes(expectedText); | ||
} | ||
case 'template': | ||
return this._verify(expectedResponse.template, actualResponse.template, this._verifyTemplate.bind(this)); | ||
default: | ||
return JSON.stringify(expectedResponse[key]) === JSON.stringify(actualResponse[key]); | ||
} | ||
} | ||
@@ -259,12 +258,12 @@ | ||
switch (key) { | ||
case 'buttons': | ||
if (expectedTemplate.buttons.length !== actualTemplate.buttons.length) { | ||
return false; | ||
} | ||
case 'buttons': | ||
if (expectedTemplate.buttons.length !== actualTemplate.buttons.length) { | ||
return false; | ||
} | ||
return expectedTemplate.buttons.every((expectedButton, i) => | ||
this._verify(expectedButton, actualTemplate.buttons[i], this._verifyTemplateButton.bind(this))); | ||
default: | ||
return JSON.stringify(expectedTemplate[key]) === JSON.stringify(actualTemplate[key]); | ||
}; | ||
return expectedTemplate.buttons.every((expectedButton, i) => | ||
this._verify(expectedButton, actualTemplate.buttons[i], this._verifyTemplateButton.bind(this))); | ||
default: | ||
return JSON.stringify(expectedTemplate[key]) === JSON.stringify(actualTemplate[key]); | ||
} | ||
} | ||
@@ -274,7 +273,7 @@ | ||
switch (key) { | ||
case 'url': | ||
return actualButton.url.startsWith(expectedButton.url); | ||
default: | ||
return JSON.stringify(expectedButton[key]) === JSON.stringify(actualButton[key]); | ||
}; | ||
case 'url': | ||
return actualButton.url.startsWith(expectedButton.url); | ||
default: | ||
return JSON.stringify(expectedButton[key]) === JSON.stringify(actualButton[key]); | ||
} | ||
} | ||
@@ -281,0 +280,0 @@ |
{ | ||
"name": "darvin-testing-framework", | ||
"version": "2.1.4", | ||
"version": "2.1.5-dev", | ||
"description": "A framework for testing Progress NativeChat bots.", | ||
"main": "index.js", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "echo \"Error: no test specified\" && exit 1", | ||
"lint": "eslint *.js", | ||
"security-pack": "tar zcvf darvin-testing-framework.tgz --exclude='./node_modules' --exclude='.git' --exclude='coverage' --exclude='reports' --exclude='.vscode' --exclude='*.tgz' *" | ||
}, | ||
@@ -20,3 +22,3 @@ "repository": { | ||
"devDependencies": { | ||
"jshint": "2.12.0" | ||
"eslint": "7.31.0" | ||
}, | ||
@@ -23,0 +25,0 @@ "dependencies": { |
Sorry, the diff of this file is not supported yet
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
No v1
QualityPackage is not semver >=1. This means it is not stable and does not support ^ ranges.
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
46786
10
283
2