Spaces:
Sleeping
Sleeping
File size: 868 Bytes
61d39e2 |
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
module.exports = class TestFactory {
static cartesian (
name,
coverageModel,
{ each, init }
) {
const do_ = async t => {
const states = coverageModel.states;
if ( init ) await init(t);
for ( let i=0 ; i < states.length ; i++ ) {
const state = states[i];
if ( t.context.options?.onlycase !== undefined ) {
if ( i !== t.context.options.onlycase ) {
continue;
}
}
await t.case(`case ${i}`, async () => {
console.log('state', state);
await each(t, state, i);
})
}
};
return {
name,
do: do_,
};
}
}
|