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

Exclude excluded bleedings

parent 3b2beabb
No related branches found
No related tags found
No related merge requests found
......@@ -42,5 +42,5 @@ function findLastFirstBleedingDay(cycleDays) {
function isBleedingDay(cycleDay) {
return cycleDay.bleeding
&& cycleDay.bleeding.value
&& !cycleDay.exclude
&& !cycleDay.bleeding.exclude
}
\ No newline at end of file
......@@ -109,6 +109,34 @@ describe('getCycleDay returns the cycle day', () => {
const result = getCycleDayNumber(cycleDays, targetDate)
expect(result).to.eql(9)
})
it('if some bleedings are exluded', function () {
const cycleDays = [{
date: moment([2018, 5, 2])
}, {
date: moment([2018, 5, 3]),
bleeding: {
value: 2
}
}, {
date: moment([2018, 5, 4])
}, {
date: moment([2018, 5, 9]),
bleeding: {
value: 2,
exclude: true
}
}, {
date: moment([2018, 5, 10]),
bleeding: {
value: 2,
exclude: true
}
}]
const targetDate = moment([2018, 5, 17])
const result = getCycleDayNumber(cycleDays, targetDate)
expect(result).to.eql(15)
})
})
describe('getCycleDay returns undefined', () => {
......
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