Skip to content
Snippets Groups Projects
Commit 8db92e96 authored by Julia Friesel's avatar Julia Friesel
Browse files

Add tests for invalid shifts

parent 1eb3f4a1
No related branches found
No related tags found
No related merge requests found
...@@ -41,6 +41,26 @@ describe.only('sensiplan', () => { ...@@ -41,6 +41,26 @@ describe.only('sensiplan', () => {
const status = detectTemperatureShift(noTempShift) const status = detectTemperatureShift(noTempShift)
expect(status).to.eql({ detected: false }) expect(status).to.eql({ detected: false })
}) })
it('detects shift after an earlier one was invalid', function () {
const temps = [36.4, 36.4, 36.4, 36.4, 36.4, 36.4, 36.6, 36.6, 36.4, 36.4, 36.7, 36.8, 36.9]
const status = detectTemperatureShift(temps)
expect(status).to.eql({
low: [36.4, 36.4, 36.6, 36.6, 36.4, 36.4],
ltl: 36.6,
high: [36.7, 36.8, 36.9],
detected: true,
rules: { regular: true }
})
})
it('detects 2 consecutive invalid shifts', function () {
const temps = [36.4, 36.4, 36.4, 36.4, 36.4, 36.4, 36.6, 36.6, 36.4, 36.4, 36.6, 36.6, 36.7]
const status = detectTemperatureShift(temps)
expect(status).to.eql({ detected: false })
})
}) })
describe('1st exception rule', () => { describe('1st exception rule', () => {
...@@ -61,6 +81,19 @@ describe.only('sensiplan', () => { ...@@ -61,6 +81,19 @@ describe.only('sensiplan', () => {
const status = detectTemperatureShift(firstExceptionNoShift) const status = detectTemperatureShift(firstExceptionNoShift)
expect(status).to.eql({ detected: false }) expect(status).to.eql({ detected: false })
}) })
it('detects shift after an earlier one was invalid', function () {
const temps = [36.4, 36.4, 36.4, 36.4, 36.4, 36.4, 36.6, 36.6, 36.4, 36.4, 36.7, 36.7, 36.7, 36.7]
const status = detectTemperatureShift(temps)
expect(status).to.eql({
low: [36.4, 36.4, 36.6, 36.6, 36.4, 36.4],
ltl: 36.6,
high: [36.7, 36.7, 36.7, 36.7],
detected: true,
rules: { firstException: true }
})
})
}) })
}) })
}) })
\ No newline at end of file
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment