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

This commit is contained in:
emelko
2018-09-05 15:31:03 +02:00
parent abee426337
commit 809b0f438f
+5 -5
View File
@@ -107,14 +107,14 @@ function throwIfArgsAreNotInRequiredFormat(cycles) {
assert.ok(cycle.length > 0) //what about 2 cycles of 1 day each?!
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.value, 'number')
assert.equal(typeof cycle[0].bleeding.value, 'number', "Bleeding value must be a number")
cycle.forEach(day => {
assert.equal(typeof day.date, 'string')
assert.doesNotThrow(() => LocalDate.parse(day.date))
if (day.temperature) assert.equal(typeof day.temperature.value, 'number')
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.temperature) assert.equal(typeof day.temperature.value, 'number', "temperature value must be 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, "mucus value must be 0 or bigger")
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.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")