Chore/retire dirty chai
This commit is contained in:
@@ -1,61 +1,52 @@
|
||||
import chai from 'chai'
|
||||
import dirtyChai from 'dirty-chai'
|
||||
import { expect } from 'chai'
|
||||
import cycleModule from '../lib/cycle'
|
||||
|
||||
const { expect } = chai
|
||||
chai.use(dirtyChai)
|
||||
|
||||
describe('getCycleForDay', () => {
|
||||
const cycleDaysSortedByDate = [
|
||||
{
|
||||
date: '2018-07-05',
|
||||
bleeding: { value: 2 }
|
||||
bleeding: { value: 2 },
|
||||
},
|
||||
{
|
||||
date: '2018-06-05',
|
||||
bleeding: { value: 2 }
|
||||
bleeding: { value: 2 },
|
||||
},
|
||||
{
|
||||
date: '2018-05-05',
|
||||
mucus: { value: 2 }
|
||||
mucus: { value: 2 },
|
||||
},
|
||||
{
|
||||
date: '2018-05-04',
|
||||
bleeding: { value: 2 }
|
||||
bleeding: { value: 2 },
|
||||
},
|
||||
{
|
||||
date: '2018-05-03',
|
||||
bleeding: { value: 2 }
|
||||
bleeding: { value: 2 },
|
||||
},
|
||||
{
|
||||
date: '2018-04-05',
|
||||
mucus: { value: 2 }
|
||||
mucus: { value: 2 },
|
||||
},
|
||||
{
|
||||
date: '2018-04-04',
|
||||
mucus: { value: 2 }
|
||||
mucus: { value: 2 },
|
||||
},
|
||||
{
|
||||
date: '2018-04-03',
|
||||
mucus: { value: 2 }
|
||||
mucus: { value: 2 },
|
||||
},
|
||||
{
|
||||
date: '2018-04-02',
|
||||
bleeding: { value: 2 }
|
||||
bleeding: { value: 2 },
|
||||
},
|
||||
]
|
||||
const cycleStarts = [
|
||||
'2018-07-05',
|
||||
'2018-06-05',
|
||||
'2018-05-03',
|
||||
'2018-04-02'
|
||||
]
|
||||
const cycleStarts = ['2018-07-05', '2018-06-05', '2018-05-03', '2018-04-02']
|
||||
|
||||
const { getCycleForDay } = cycleModule({
|
||||
cycleDaysSortedByDate,
|
||||
cycleStartsSortedByDate: cycleDaysSortedByDate.filter(d => {
|
||||
cycleStartsSortedByDate: cycleDaysSortedByDate.filter((d) => {
|
||||
return cycleStarts.includes(d.date)
|
||||
})
|
||||
}),
|
||||
})
|
||||
|
||||
it('gets cycle that has only one day', () => {
|
||||
@@ -64,16 +55,16 @@ describe('getCycleForDay', () => {
|
||||
expect(result).to.eql([
|
||||
{
|
||||
date: '2018-07-05',
|
||||
bleeding: { value: 2 }
|
||||
}
|
||||
bleeding: { value: 2 },
|
||||
},
|
||||
])
|
||||
const result2 = getCycleForDay('2018-06-05')
|
||||
expect(result2.length).to.eql(1)
|
||||
expect(result2).to.eql([
|
||||
{
|
||||
date: '2018-06-05',
|
||||
bleeding: { value: 2 }
|
||||
}
|
||||
bleeding: { value: 2 },
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
@@ -83,8 +74,8 @@ describe('getCycleForDay', () => {
|
||||
expect(result).to.eql([
|
||||
{
|
||||
date: '2018-06-05',
|
||||
bleeding: { value: 2 }
|
||||
}
|
||||
bleeding: { value: 2 },
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
@@ -96,10 +87,10 @@ describe('getCycleForDay', () => {
|
||||
it('returns null if the cycle is longer than the max', () => {
|
||||
const { getCycleForDay } = cycleModule({
|
||||
cycleDaysSortedByDate,
|
||||
cycleStartsSortedByDate: cycleDaysSortedByDate.filter(d => {
|
||||
cycleStartsSortedByDate: cycleDaysSortedByDate.filter((d) => {
|
||||
return cycleStarts.includes(d.date)
|
||||
}),
|
||||
maxCycleLength: 3
|
||||
maxCycleLength: 3,
|
||||
})
|
||||
const result = getCycleForDay('2018-04-04')
|
||||
expect(result).to.eql(null)
|
||||
@@ -111,19 +102,19 @@ describe('getCycleForDay', () => {
|
||||
expect(result).to.eql([
|
||||
{
|
||||
date: '2018-04-05',
|
||||
mucus: { value: 2 }
|
||||
mucus: { value: 2 },
|
||||
},
|
||||
{
|
||||
date: '2018-04-04',
|
||||
mucus: { value: 2 }
|
||||
mucus: { value: 2 },
|
||||
},
|
||||
{
|
||||
date: '2018-04-03',
|
||||
mucus: { value: 2 }
|
||||
mucus: { value: 2 },
|
||||
},
|
||||
{
|
||||
date: '2018-04-02',
|
||||
bleeding: { value: 2 }
|
||||
bleeding: { value: 2 },
|
||||
},
|
||||
])
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user