Files
drip/test/get-cycle-by-start-day.spec.js
T
Sofiya Tepikin a103949f7c Chore/jest
2022-08-12 09:31:33 +00:00

34 lines
782 B
JavaScript

import cycleModule from '../lib/cycle'
const cycleStartDay = { date: '2018-05-03' }
const cycle = [{ date: '2018-05-05' }, { date: '2018-05-04' }, cycleStartDay]
const cycleDaysSortedByDate = [
{ date: '2018-07-05' },
{ date: '2018-06-05' },
...cycle,
{ date: '2018-04-05' },
{ date: '2018-04-04' },
{ date: '2018-04-03' },
{ date: '2018-04-02' },
]
const cycleStartsSortedByDate = [
{ date: '2018-07-05' },
{ date: '2018-06-05' },
{ date: '2018-05-03' },
{ date: '2018-04-02' },
]
describe('getCycleByStartDay', () => {
test('gets cycle by cycle start day', () => {
const { getCycleByStartDay } = cycleModule({
cycleDaysSortedByDate,
cycleStartsSortedByDate,
})
expect(getCycleByStartDay(cycleStartDay)).toEqual(cycle)
})
})