Add more details to cervix-temp fixtures and to mucus-temp spec

This commit is contained in:
emelko
2018-08-13 11:31:21 +02:00
parent e81c30f7b9
commit 21d6e24f23
2 changed files with 560 additions and 570 deletions
+6 -11
View File
@@ -37,17 +37,12 @@ export const cycleWithFhmNoCervixShift = [
{ 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 },
{ date: '2018-06-08', temperature: 36.7 },
{ date: '2018-06-09', temperature: 36.7 },
{ date: '2018-06-10', temperature: 36.7 },
{ date: '2018-06-11', temperature: 36.7 },
{ date: '2018-06-12', temperature: 36.7 },
{ date: '2018-06-13', temperature: 36.8 },
{ date: '2018-06-15', temperature: 36.9 },
{ date: '2018-06-16', temperature: 36.9 },
{ date: '2018-06-17', temperature: 36.9 },
{ date: '2018-06-18', temperature: 36.9 }
{ date: '2018-06-06', temperature: 36.7, cervix: { isClosed: true, isHard: true } },
{ date: '2018-06-13', temperature: 36.8, cervix: { isClosed: false, isHard: false } },
{ date: '2018-06-15', temperature: 36.9, cervix: { isClosed: false, isHard: false } },
{ date: '2018-06-17', temperature: 36.9, cervix: { isClosed: false, isHard: false } },
{ date: '2018-06-17', temperature: 36.9, cervix: { isClosed: false, isHard: false } },
{ date: '2018-06-18', temperature: 36.9, cervix: { isClosed: false, isHard: false } }
].map(convertToSymptoFormat)
export const cycleWithoutFhm = [
+8 -13
View File
@@ -23,33 +23,27 @@ import {
const expect = chai.expect
describe('sympto', () => {
describe('with no previous higher measurement', () => {
describe('combining temperature and mucus tracking', () => {
describe('with no previous higher temp measurement', () => {
it('with no shifts detects only peri-ovulatory', function () {
const status = getSensiplanStatus({
cycle: cycleWithoutAnyShifts,
previousCycle: cycleWithoutFhm
})
expect(status).to.eql({
phases: {
periOvulatory: {
expect(status.phases.periOvulatory).to.eql({
start: { date: '2018-06-01' },
cycleDays: cycleWithoutAnyShifts
}
},
})
})
it('with shifts detects only peri-ovulatory and post-ovulatory', () => {
it('with temp and mucus shifts detects only peri-ovulatory and post-ovulatory', () => {
const status = getSensiplanStatus({
cycle: longAndComplicatedCycle,
previousCycle: cycleWithoutFhm
})
expect(status.temperatureShift).to.be.an('object')
expect(status.mucusShift).to.be.an('object')
expect(Object.keys(status.phases).length).to.eql(2)
expect(status.phases.periOvulatory).to.eql({
start: { date: '2018-06-01' },
@@ -65,8 +59,10 @@ describe('sympto', () => {
cycleDays: longAndComplicatedCycle
.filter(({date}) => date >= '2018-06-21')
})
})
})
describe('with previous higher measurement', () => {
describe('with no shifts detects pre-ovulatory phase', function () {
it('according to 5-day-rule', function () {
@@ -76,14 +72,12 @@ describe('sympto', () => {
})
expect(Object.keys(status.phases).length).to.eql(1)
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', () => {
it('according to 5-day-rule', function () {
@@ -622,4 +616,5 @@ describe('sympto', () => {
})).to.throw(AssertionError)
})
})
})
})