Shorten pre-ovu phase when early mucus
This commit is contained in:
+25
-1
@@ -63,6 +63,29 @@ const cycleWithTempAndNoMucusShift = [
|
||||
{ date: '2018-06-27', temperature: 36.9, mucus: 4 }
|
||||
].map(convertToSymptoFormat)
|
||||
|
||||
const cycleWithEarlyMucus = [
|
||||
{ date: '2018-06-01', temperature: 36.6, bleeding: 2 },
|
||||
{ date: '2018-06-02', temperature: 36.65, mucus: 3 },
|
||||
{ date: '2018-06-05', temperature: 36.55 },
|
||||
{ date: '2018-06-06', temperature: 36.7, mucus: 0 },
|
||||
{ date: '2018-06-08', temperature: 36.45, mucus: 1 },
|
||||
{ date: '2018-06-09', temperature: 36.5, mucus: 4 },
|
||||
{ date: '2018-06-10', temperature: 36.4, mucus: 2 },
|
||||
{ date: '2018-06-11', temperature: 36.5, mucus: 3 },
|
||||
{ date: '2018-06-13', temperature: 36.45, mucus: 3 },
|
||||
{ date: '2018-06-14', temperature: 36.5, mucus: 4 },
|
||||
{ date: '2018-06-15', temperature: 36.55, mucus: 4 },
|
||||
{ date: '2018-06-16', temperature: 36.7, mucus: 3 },
|
||||
{ date: '2018-06-17', temperature: 36.65, mucus: 3 },
|
||||
{ date: '2018-06-18', temperature: 36.75, mucus: 4 },
|
||||
{ date: '2018-06-19', temperature: 36.8, mucus: 4 },
|
||||
{ date: '2018-06-20', temperature: 36.85, mucus: 4 },
|
||||
{ date: '2018-06-23', temperature: 36.9, mucus: 3 },
|
||||
{ date: '2018-06-24', temperature: 36.85, mucus: 4 },
|
||||
{ date: '2018-06-26', temperature: 36.8, mucus: 4 },
|
||||
{ date: '2018-06-27', temperature: 36.9, mucus: 4 }
|
||||
].map(convertToSymptoFormat)
|
||||
|
||||
const cycleWithoutAnyShifts = [
|
||||
{ date: '2018-06-01', temperature: 36.6, bleeding: 2 },
|
||||
{ date: '2018-06-02', temperature: 36.65 },
|
||||
@@ -84,5 +107,6 @@ export {
|
||||
cycleWithTempAndNoMucusShift,
|
||||
cycleWithTempShift,
|
||||
cycleWithoutAnyShifts,
|
||||
fiveDayCycle
|
||||
fiveDayCycle,
|
||||
cycleWithEarlyMucus
|
||||
}
|
||||
@@ -1,7 +1,13 @@
|
||||
import chai from 'chai'
|
||||
import getSensiplanStatus from '../../lib/sympto'
|
||||
import {
|
||||
cycleWithoutTempShift, cycleWithTempAndMucusShift, cycleWithTempAndNoMucusShift, cycleWithTempShift, cycleWithoutAnyShifts, fiveDayCycle
|
||||
cycleWithoutTempShift,
|
||||
cycleWithTempAndMucusShift,
|
||||
cycleWithTempAndNoMucusShift,
|
||||
cycleWithTempShift,
|
||||
cycleWithoutAnyShifts,
|
||||
fiveDayCycle,
|
||||
cycleWithEarlyMucus
|
||||
} from './fixtures'
|
||||
|
||||
const expect = chai.expect
|
||||
@@ -86,7 +92,24 @@ describe('sympto', () => {
|
||||
start: { date: '2018-06-06' }
|
||||
})
|
||||
})
|
||||
it('according to 5-day-rule with shortened pre-phase', function () {
|
||||
const status = getSensiplanStatus({
|
||||
cycle: cycleWithEarlyMucus,
|
||||
previousCycle: cycleWithTempShift
|
||||
})
|
||||
|
||||
expect(Object.keys(status.phases).length).to.eql(2)
|
||||
expect(status.assumeFertility).to.be.true()
|
||||
expect(status.phases.preOvulatory).to.eql({
|
||||
cycleDays: [cycleWithEarlyMucus[0]],
|
||||
start: { date: '2018-06-01' },
|
||||
end: { date: '2018-06-01' }
|
||||
})
|
||||
expect(status.phases.periOvulatory).to.eql({
|
||||
cycleDays: cycleWithEarlyMucus.slice(1),
|
||||
start: { date: '2018-06-02' }
|
||||
})
|
||||
})
|
||||
})
|
||||
describe('with shifts detects pre- and peri-ovulatory phase', function () {
|
||||
it('according to 5-day-rule', function () {
|
||||
|
||||
Reference in New Issue
Block a user