Skip to content

Commit

Permalink
Improved integration tests
Browse files Browse the repository at this point in the history
  • Loading branch information
klein0r committed Nov 3, 2023
1 parent d3060e2 commit c106b79
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions test/integration.js
Original file line number Diff line number Diff line change
Expand Up @@ -785,17 +785,19 @@ tests.integration(path.join(__dirname, '..'), {
});
});

it('calculation no false', async function () {
it('calculation (no false)', async function () {
this.timeout(60000);
await sleep(1000);

const tempId = `${harness.adapterName}.0.temp.count.${customBooleanObjId}`;

await assertStateChangesTo(harness, `${tempId}.day`, 11, () => {
for (let i = 0; i < 10; i++) {
harness.states.setState(customBooleanObjId, { val: true, ack: true });
}
});
// just +1 (ignore other setState)
for (let i = 0; i < 10; i++) {
await harness.states.setStateAsync(customBooleanObjId, { val: true, ack: true });
}

await sleep(1000);
await assertStateEquals(harness, `${tempId}.day`, 11);
});
});

Expand Down Expand Up @@ -869,14 +871,12 @@ tests.integration(path.join(__dirname, '..'), {

const tempId = `${harness.adapterName}.0.temp.sumCount.${customBooleanObjId}`;

for (let i = 0; i < 10; i++) {
await harness.states.setStateAsync(customBooleanObjId, { val: true, ack: true });
await sleep(100);
await harness.states.setStateAsync(customBooleanObjId, { val: false, ack: true });
await sleep(200);
}

await assertStateEquals(harness, `${tempId}.day`, 30);
await assertStateChangesTo(harness, `${tempId}.day`, 30, () => {
for (let i = 0; i < 10; i++) {
harness.states.setState(customBooleanObjId, { val: true, ack: true });
harness.states.setState(customBooleanObjId, { val: false, ack: true });
}
});
});
});

Expand Down Expand Up @@ -933,7 +933,7 @@ tests.integration(path.join(__dirname, '..'), {
sumIgnoreMinus: true, // relevant for this test
groupFactor: 0.001, // relevant for this test
sumGroup: 'energy', // relevant for this test
logName: 'mySumGroupByDeltaNumber'
logName: 'mySumGroupByDeltaNumber1'
}
}
},
Expand Down Expand Up @@ -963,7 +963,7 @@ tests.integration(path.join(__dirname, '..'), {
sumIgnoreMinus: false, // relevant for this test
groupFactor: 0.005, // relevant for this test
sumGroup: 'energy', // relevant for this test
logName: 'mySumGroupByDeltaNumber'
logName: 'mySumGroupByDeltaNumber2'
}
}
},
Expand Down

0 comments on commit c106b79

Please sign in to comment.