runapptests - Fix call assertions
parent
52c17dffbf
commit
a597489c69
|
|
@ -162,32 +162,31 @@ function wrap(func, id){
|
||||||
}
|
}
|
||||||
|
|
||||||
function assertCall(step){
|
function assertCall(step){
|
||||||
let isOK = false;
|
let isOK = true;
|
||||||
let id = step.id;
|
let id = step.id;
|
||||||
let args = step.argAsserts;
|
let args = step.argAsserts;
|
||||||
|
if (step.count !== undefined){
|
||||||
let calls = getValue(`global.APPTESTS.funcCalls.${id}`);
|
let calls = getValue(`global.APPTESTS.funcCalls.${id}`);
|
||||||
if ((args.count && args.count == calls) || (!args.count && calls > 0)){
|
isOK = step.count == calls
|
||||||
if (args) {
|
}
|
||||||
|
if (args && args.length > 0){
|
||||||
let callArgs = getValue(`global.APPTESTS.funcArgs.${id}`);
|
let callArgs = getValue(`global.APPTESTS.funcArgs.${id}`);
|
||||||
for (let a of args){
|
for (let a of args){
|
||||||
let current = {
|
let current = {
|
||||||
value: callArgs[a.arg],
|
js: callArgs[a.arg],
|
||||||
is: a.is,
|
is: a.is,
|
||||||
to: a.to,
|
to: a.to,
|
||||||
text: step.text
|
text: step.text
|
||||||
};
|
};
|
||||||
switch(a.t){
|
switch(a.t){
|
||||||
case "assertArray":
|
case "assertArray":
|
||||||
isOK = assertArray(current);
|
isOK = isOK && assertArray(current);
|
||||||
break;
|
break;
|
||||||
case "assert":
|
case "assert":
|
||||||
isOK = assertValue(current);
|
isOK = isOK && assertValue(current);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
|
||||||
isOK = true;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
if (isOK)
|
if (isOK)
|
||||||
console.log("OK - ASSERT CALL", step.text ? "- " + step.text : "");
|
console.log("OK - ASSERT CALL", step.text ? "- " + step.text : "");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue