Skip to content
Snippets Groups Projects
Commit 809b0f43 authored by emelko's avatar emelko
Browse files

Adding more error messages for better understanding of failing tests when arguments are wrong <3

parent abee4263
No related branches found
No related tags found
No related merge requests found
...@@ -107,14 +107,14 @@ function throwIfArgsAreNotInRequiredFormat(cycles) { ...@@ -107,14 +107,14 @@ function throwIfArgsAreNotInRequiredFormat(cycles) {
assert.ok(cycle.length > 0) //what about 2 cycles of 1 day each?! assert.ok(cycle.length > 0) //what about 2 cycles of 1 day each?!
assert.ok(cycle[0].bleeding !== null) assert.ok(cycle[0].bleeding !== null)
assert.equal(typeof cycle[0].bleeding, 'object', "First cycle day must contain bleeding value") assert.equal(typeof cycle[0].bleeding, 'object', "First cycle day must contain bleeding value")
assert.equal(typeof cycle[0].bleeding.value, 'number') assert.equal(typeof cycle[0].bleeding.value, 'number', "Bleeding value must be a number")
cycle.forEach(day => { cycle.forEach(day => {
assert.equal(typeof day.date, 'string') assert.equal(typeof day.date, 'string')
assert.doesNotThrow(() => LocalDate.parse(day.date)) assert.doesNotThrow(() => LocalDate.parse(day.date))
if (day.temperature) assert.equal(typeof day.temperature.value, 'number') if (day.temperature) assert.equal(typeof day.temperature.value, 'number', "temperature value must be number")
if (day.mucus) assert.equal(typeof day.mucus.value, 'number') if (day.mucus) assert.equal(typeof day.mucus.value, 'number', "mucus value must be number")
if (day.mucus) assert.ok(day.mucus.value >= 0) if (day.mucus) assert.ok(day.mucus.value >= 0, "mucus value must be 0 or bigger")
if (day.mucus) assert.ok(day.mucus.value < 5) if (day.mucus) assert.ok(day.mucus.value <= 4, "mucus value must be 4 or smaller")
if (day.cervix) assert.equal(typeof day.cervix.value, 'object') 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 >= 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.opening <= 2, "cervix opening value must be 2 or smaller")
......
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