Handle pre-ovulatory = current

This commit is contained in:
Julia Friesel
2018-07-10 13:22:34 +02:00
parent 51bd75fb0f
commit 0de009335f
3 changed files with 38 additions and 10 deletions
+10 -1
View File
@@ -83,10 +83,19 @@ const cycleWithoutAnyShifts = [
{ temperature: 36.45, mucus: 1 }
].map(convertToSymptoFormat)
const fiveDayCycle = [
{ temperature: 36.6, bleeding: 2 },
{ temperature: 36.65 },
{ temperature: 36.5 },
{ temperature: 36.6 },
{ temperature: 36.55 }
].map(convertToSymptoFormat)
export {
cycleWithoutTempShift,
cycleWithTempAndMucusShift,
cycleWithTempAndNoMucusShift,
cycleWithTempShift,
cycleWithoutAnyShifts
cycleWithoutAnyShifts,
fiveDayCycle
}
+18 -1
View File
@@ -1,7 +1,7 @@
import chai from 'chai'
import getSensiplanStatus from '../../lib/sympto'
import {
cycleWithoutTempShift, cycleWithTempAndMucusShift, cycleWithTempAndNoMucusShift, cycleWithTempShift, cycleWithoutAnyShifts
cycleWithoutTempShift, cycleWithTempAndMucusShift, cycleWithTempAndNoMucusShift, cycleWithTempShift, cycleWithoutAnyShifts, fiveDayCycle
} from './fixtures'
const expect = chai.expect
@@ -52,6 +52,23 @@ describe('sympto', () => {
})
})
describe('with previous higher measurement', () => {
describe('with no shifts detects pre-ovulatory phase', function () {
it('according to 5-day-rule', function () {
const status = getSensiplanStatus({
cycle: fiveDayCycle,
previousCycle: cycleWithTempShift
})
expect(Object.keys(status.phases).length).to.eql(1)
expect(status.assumeFertility).to.be.false()
expect(status.phases.preOvulatory).to.eql({
cycleDays: fiveDayCycle,
start: { date: '2018-06-01' },
end: { date: '2018-06-05' }
})
})
})
describe('with no shifts detects pre- and peri-ovulatory phase', function () {
it('according to 5-day-rule', function () {
const status = getSensiplanStatus({