mirror of https://github.com/espruino/BangleApps
runapptests - Allow resetting the recorded calls
parent
107727ce6b
commit
d10fe4b2fb
|
@ -57,7 +57,9 @@ const DEMOTEST = {
|
|||
{"t":"assertArray", "js": "[1,2,3]", "is":"notEmpty", "text": "Evaluates the content of 'js' on the device and asserts if the result is an array with more than 0 entries"},
|
||||
{"t":"cmd", "js": "global.testfunction(1)", "text": "Call function for the following asserts"},
|
||||
{"t":"assertCall", "id": "testfunc", "argAsserts": [ { "t": "assert", "arg": "0", "is": "equal", "to": 1 } ] , "text": "Asserts if a wrapped function has been called with the expected arguments"},
|
||||
{"t":"assertCall", "id": "testfunc", "count": 1 , "text": "Asserts if a wrapped function has been called the expected number of times"}
|
||||
{"t":"assertCall", "id": "testfunc", "count": 1 , "text": "Asserts if a wrapped function has been called the expected number of times"},
|
||||
{"t":"resetCall", "id": "testfunc", "text": "Reset the recorded calls"},
|
||||
{"t":"assertCall", "id": "testfunc", "count": 0 , "text": "Asserts if a wrapped function has been called the expected number of times"}
|
||||
]
|
||||
}]
|
||||
}
|
||||
|
@ -276,6 +278,11 @@ function runStep(step, subtest, test, state){
|
|||
state.ok &= assertArray(step);
|
||||
});
|
||||
break;
|
||||
case "resetCall":
|
||||
console.log(`> RESET CALL ${step.id}`);
|
||||
emu.tx(`global.APPTESTS.funcCalls.${step.id} = 0;\n`);
|
||||
emu.tx(`global.APPTESTS.funcArgs.${step.id} = undefined;\n`);
|
||||
break;
|
||||
case "assertCall":
|
||||
p = p.then(() => {
|
||||
state.ok &= assertCall(step);
|
||||
|
|
Loading…
Reference in New Issue