Changes cervix value to check for opening and firmness value

This commit is contained in:
emelko
2018-09-05 15:27:04 +02:00
parent 21d6e24f23
commit 1c2c45f8c6
3 changed files with 148 additions and 138 deletions
+2 -2
View File
@@ -36,6 +36,6 @@ export default function (cycleDays, tempEvalEndIndex) {
return { detected: false }
}
function isClosedAndHard (cervixValue) {
return cervixValue.isClosed && cervixValue.isHard
function isClosedAndHard (cervix) {
return cervix.value.opening === 0 && cervix.value.firmness === 0
}
+5 -2
View File
@@ -112,8 +112,11 @@ function throwIfArgsAreNotInRequiredFormat(cycles) {
if (day.mucus) assert.equal(typeof day.mucus.value, 'number')
if (day.mucus) assert.ok(day.mucus.value >= 0)
if (day.mucus) assert.ok(day.mucus.value < 5)
if (day.cervix) assert.equal(typeof day.cervix.isClosed, 'boolean')
if (day.cervix) assert.equal(typeof day.cervix.isHard, 'boolean')
if (day.cervix) assert.equal(typeof day.cervix.value, 'object')
if (day.cervix) assert.ok(day.cervix.value.opening >= 0, "cervix opening value must be 0 or bigger")
if (day.cervix) assert.ok(day.cervix.value.opening <= 2, "cervix opening value must be 2 or smaller")
if (day.cervix) assert.ok(day.cervix.value.firmness >= 0, "cervix firmness value must be 0 or bigger")
if (day.cervix) assert.ok(day.cervix.value.firmness <= 1, "cervix firmness value must be 1 or smaller")
})
})
}