Handle cycle with mucus on first cycle day

This commit is contained in:
Julia Friesel
2018-07-24 14:21:10 +02:00
parent 5468c8051d
commit 5ce6bc8cfc
4 changed files with 53 additions and 3 deletions
+23
View File
@@ -100,6 +100,29 @@ export const cycleWithEarlyMucus = [
{ date: '2018-06-27', temperature: 36.9, mucus: 4 }
].map(convertToSymptoFormat)
export const cycleWithMucusOnFirstDay = [
{ date: '2018-06-01', temperature: 36.6, bleeding: 2, mucus: 3},
{ 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)
export const cycleWithoutAnyShifts = [
{ date: '2018-06-01', temperature: 36.6, bleeding: 2 },
{ date: '2018-06-02', temperature: 36.65 },
+18
View File
@@ -9,6 +9,7 @@ import {
cycleWithoutAnyShifts,
fiveDayCycle,
cycleWithEarlyMucus,
cycleWithMucusOnFirstDay,
mucusPeakAndFhmOnSameDay,
fhmTwoDaysBeforeMucusPeak,
fhm5DaysAfterMucusPeak,
@@ -453,6 +454,23 @@ describe('sympto', () => {
})
})
})
it('shortens the pre-ovu phase if mucus occurs even on the first day', () => {
const status = getSensiplanStatus({
cycle: cycleWithMucusOnFirstDay,
previousCycle: fhmOnDay12,
earlierCycles: Array(10).fill(fhmOnDay12)
})
expect(Object.keys(status.phases).length).to.eql(1)
expect(status.phases.periOvulatory).to.eql({
start: { date: '2018-06-01' },
cycleDays: cycleWithMucusOnFirstDay
})
})
it('lengthens the pre-ovu phase if >= 12 cycles with fhm > 13', () => {
const status = getSensiplanStatus({
cycle: longAndComplicatedCycle,