Skip to content
Snippets Groups Projects
Commit 93ff7a0f authored by Julia Friesel's avatar Julia Friesel
Browse files

Set up failing test for minus 8 rule

parent 19e88018
No related branches found
No related tags found
No related merge requests found
......@@ -38,4 +38,4 @@ function getDaysUntilFertileMucus(days) {
return days
}
function apply8DayRule() {}
\ No newline at end of file
function apply8DayRule(previousCycles) {}
\ No newline at end of file
......@@ -7,17 +7,17 @@ function convertToSymptoFormat(val) {
return sympto
}
const cycleWithTempShift = [36.6, 36.6, 36.6, 36.6, 36.6, 36.6, 36.8, 36.8, 36.8]
export const cycleWithTempShift = [36.6, 36.6, 36.6, 36.6, 36.6, 36.6, 36.8, 36.8, 36.8]
.map(num => ({ date: '2018-06-01', temperature: num }))
.map(convertToSymptoFormat)
cycleWithTempShift.unshift({date: '2018-05-30', bleeding: { value: 2 }})
const cycleWithoutTempShift = [36.6, 36.6, 36.6, 36.6, 36.6, 36.6, 36.8, 36.8]
export const cycleWithoutTempShift = [36.6, 36.6, 36.6, 36.6, 36.6, 36.6, 36.8, 36.8]
.map(num => ({ date: '2018-06-01', temperature: num }))
.map(convertToSymptoFormat)
cycleWithoutTempShift.unshift({date: '2018-05-30', bleeding: { value: 2 }})
const cycleWithTempAndMucusShift = [
export const cycleWithTempAndMucusShift = [
{ date: '2018-06-01', temperature: 36.6, bleeding: 2 },
{ date: '2018-06-02', temperature: 36.65 },
{ date: '2018-06-04', temperature: 36.6 },
......@@ -40,7 +40,7 @@ const cycleWithTempAndMucusShift = [
{ date: '2018-06-27', temperature: 36.9, mucus: 1 }
].map(convertToSymptoFormat)
const cycleWithTempAndNoMucusShift = [
export const cycleWithTempAndNoMucusShift = [
{ date: '2018-06-01', temperature: 36.6, bleeding: 2 },
{ date: '2018-06-02', temperature: 36.65 },
{ date: '2018-06-05', temperature: 36.55 },
......@@ -63,7 +63,7 @@ const cycleWithTempAndNoMucusShift = [
{ date: '2018-06-27', temperature: 36.9, mucus: 4 }
].map(convertToSymptoFormat)
const cycleWithEarlyMucus = [
export 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 },
......@@ -86,7 +86,7 @@ const cycleWithEarlyMucus = [
{ date: '2018-06-27', temperature: 36.9, mucus: 4 }
].map(convertToSymptoFormat)
const cycleWithoutAnyShifts = [
export const cycleWithoutAnyShifts = [
{ date: '2018-06-01', temperature: 36.6, bleeding: 2 },
{ date: '2018-06-02', temperature: 36.65 },
{ date: '2018-06-04', temperature: 36.6 },
......@@ -96,12 +96,12 @@ const cycleWithoutAnyShifts = [
{ date: '2018-06-08', temperature: 36.45, mucus: 1 }
].map(convertToSymptoFormat)
const fiveDayCycle = [
export const fiveDayCycle = [
{ date: '2018-06-01', bleeding: 2 },
{ date: '2018-06-03', bleeding: 3 },
].map(convertToSymptoFormat)
const mucusPeakAndFhmOnSameDay = [
export const mucusPeakAndFhmOnSameDay = [
{ date: '2018-06-01', temperature: 36.6, bleeding: 2 },
{ date: '2018-06-02', temperature: 36.65 },
{ date: '2018-06-04', temperature: 36.6 },
......@@ -124,7 +124,7 @@ const mucusPeakAndFhmOnSameDay = [
{ date: '2018-06-27', temperature: 36.9, mucus: 1 }
].map(convertToSymptoFormat)
const fhmTwoDaysBeforeMucusPeak = [
export const fhmTwoDaysBeforeMucusPeak = [
{ date: '2018-06-01', temperature: 36.6, bleeding: 2 },
{ date: '2018-06-02', temperature: 36.65 },
{ date: '2018-06-04', temperature: 36.6 },
......@@ -146,7 +146,7 @@ const fhmTwoDaysBeforeMucusPeak = [
{ date: '2018-06-26', temperature: 36.8, mucus: 1 },
].map(convertToSymptoFormat)
const mucusPeakTwoDaysBeforeFhm = [
export const mucusPeakTwoDaysBeforeFhm = [
{ date: '2018-06-01', temperature: 36.6, bleeding: 2 },
{ date: '2018-06-02', temperature: 36.65 },
{ date: '2018-06-04', temperature: 36.6 },
......@@ -165,7 +165,7 @@ const mucusPeakTwoDaysBeforeFhm = [
{ date: '2018-07-04', temperature: 36.8, mucus: 2 },
].map(convertToSymptoFormat)
const mucusPeak5DaysAfterFhm = [
export const mucusPeak5DaysAfterFhm = [
{ date: '2018-06-01', temperature: 36.6, bleeding: 2 },
{ date: '2018-06-02', temperature: 36.65, mucus: 2 },
{ date: '2018-06-04', temperature: 36.6 },
......@@ -190,7 +190,7 @@ const mucusPeak5DaysAfterFhm = [
{ date: '2018-07-02', temperature: 36.9, mucus: 1 }
].map(convertToSymptoFormat)
const fhm5DaysAfterMucusPeak = [
export const fhm5DaysAfterMucusPeak = [
{ date: '2018-06-01', temperature: 36.6, bleeding: 2 },
{ date: '2018-06-02', temperature: 36.65 },
{ date: '2018-06-04', temperature: 36.6 },
......@@ -213,17 +213,15 @@ const fhm5DaysAfterMucusPeak = [
{ date: '2018-06-27', temperature: 36.9, mucus: 1 }
].map(convertToSymptoFormat)
export {
cycleWithoutTempShift,
cycleWithTempAndMucusShift,
cycleWithTempAndNoMucusShift,
cycleWithTempShift,
cycleWithoutAnyShifts,
fiveDayCycle,
cycleWithEarlyMucus,
fhm5DaysAfterMucusPeak,
fhmTwoDaysBeforeMucusPeak,
mucusPeak5DaysAfterFhm,
mucusPeakAndFhmOnSameDay,
mucusPeakTwoDaysBeforeFhm
}
\ No newline at end of file
export const fhmOnDay12 = [
{ date: '2018-06-01', temperature: 36.6, bleeding: 2 },
{ date: '2018-06-02', temperature: 36.65 },
{ date: '2018-06-04', temperature: 36.6 },
{ date: '2018-06-05', temperature: 36.55 },
{ date: '2018-06-06', temperature: 36.7, mucus: 0 },
{ date: '2018-06-09', temperature: 36.5, mucus: 2 },
{ date: '2018-06-10', temperature: 36.4, mucus: 3 },
{ date: '2018-06-12', temperature: 36.8, mucus: 3 },
{ date: '2018-06-14', temperature: 36.9, mucus: 2 },
{ date: '2018-06-17', temperature: 36.9, mucus: 2 },
].map(convertToSymptoFormat)
......@@ -13,7 +13,8 @@ import {
fhmTwoDaysBeforeMucusPeak,
fhm5DaysAfterMucusPeak,
mucusPeak5DaysAfterFhm,
mucusPeakTwoDaysBeforeFhm
mucusPeakTwoDaysBeforeFhm,
fhmOnDay12
} from './fixtures'
const expect = chai.expect
......@@ -303,7 +304,36 @@ describe('sympto', () => {
})
describe('applying the minus-8 rule', () => {
it('shortens the pre-ovu phase if there is a previous <13 fhm')
it('shortens the pre-ovu phase if there is a previous <13 fhm', () => {
const status = getSensiplanStatus({
cycle: cycleWithTempAndMucusShift,
previousCycles: [fhmOnDay12, cycleWithTempShift]
})
expect(status.temperatureShift).to.be.an('object')
expect(status.mucusShift).to.be.an('object')
expect(status.assumeFertility).to.be.false()
expect(Object.keys(status.phases).length).to.eql(3)
expect(status.phases.preOvulatory).to.eql({
start: { date: '2018-06-01' },
end: { date: '2018-06-04' },
cycleDays: fhm5DaysAfterMucusPeak.filter(({date}) => date <= '2018-06-04')
})
expect(status.phases.periOvulatory).to.eql({
start: { date: '2018-06-05' },
end: { date: '2018-06-17', time: '18:00' },
cycleDays: fhm5DaysAfterMucusPeak.filter(({date}) => {
return date > '2018-06-04' && date <= '2018-06-17'
})
})
expect(status.phases.postOvulatory).to.eql({
start: {
date: '2018-06-17',
time: '18:00'
},
cycleDays: fhm5DaysAfterMucusPeak.filter(({date}) => date >= '2018-06-17')
})
})
it('shortens the pre-ovu phase if there is a previous <13 fhm with less than 12 cycles')
it('shortens the pre-ovu phase if mucus occurs')
it('lengthens the pre-ovu phase if >= 12 cycles')
......
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