From e1d6345434cbda512e1dbc9485208fd8ba2de3cf Mon Sep 17 00:00:00 2001 From: emelko <ml.kochsiek@mailbox.org> Date: Sat, 8 Sep 2018 12:57:38 +0200 Subject: [PATCH] Removing comment & making error comments even more helpful --- lib/sympto/index.js | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/lib/sympto/index.js b/lib/sympto/index.js index 3c8207fe..d73d635d 100644 --- a/lib/sympto/index.js +++ b/lib/sympto/index.js @@ -104,21 +104,21 @@ export default function getSymptoThermalStatus(cycleInfo) { function throwIfArgsAreNotInRequiredFormat(cycles) { cycles.forEach(cycle => { assert.ok(Array.isArray(cycle), "Cycles must be arrays.") - assert.ok(cycle.length > 0, "Cycle must not be empty.") //what about 2 cycles of 1 day each?! + assert.ok(cycle.length > 0, "Cycle must not be empty.") assert.ok(cycle[0].bleeding !== null, "First cycle day should have bleeding.") assert.equal(typeof cycle[0].bleeding, 'object', "First cycle day must contain bleeding value.") - assert.equal(typeof cycle[0].bleeding.value, 'number', "First cycle day bleeding value is a number.") + assert.equal(typeof cycle[0].bleeding.value, 'number', "First cycle day bleeding value must be a number.") cycle.forEach(day => { - assert.equal(typeof day.date, 'string', "Date is given as a string.") - assert.doesNotThrow(() => LocalDate.parse(day.date), "Date is given in right string format.") - if (day.temperature) assert.equal(typeof day.temperature.value, 'number', "Temperature value is a number.") - if (day.mucus) assert.equal(typeof day.mucus.value, 'number', "Mucus value is a number.") - if (day.mucus) assert.ok(day.mucus.value >= 0, "Mucus value is greater or equal to 0.") - if (day.mucus) assert.ok(day.mucus.value <= 4, "Mucus value below 5.") - 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") + assert.equal(typeof day.date, 'string', "Date must be given as a string.") + assert.doesNotThrow(() => LocalDate.parse(day.date), "Date must be given in right string format.") + if (day.temperature) assert.equal(typeof day.temperature.value, 'number', "Temperature value must be a number.") + if (day.mucus) assert.equal(typeof day.mucus.value, 'number', "Mucus value must be a number.") + if (day.mucus) assert.ok(day.mucus.value >= 0, "Mucus value must greater or equal to 0.") + if (day.mucus) assert.ok(day.mucus.value <= 4, "Mucus value must be below 5.") + 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") assert.equal(typeof cycle[0].bleeding.value, 'number', "Bleeding value must be a number") }) }) -- GitLab