Chore/jest

This commit is contained in:
Sofiya Tepikin
2022-08-12 09:31:33 +00:00
parent 0cd2770996
commit a103949f7c
16 changed files with 6978 additions and 912 deletions
+15 -16
View File
@@ -1,4 +1,3 @@
import { expect } from 'chai'
import cycleModule from '../lib/cycle'
describe('getCycleForDay', () => {
@@ -49,18 +48,18 @@ describe('getCycleForDay', () => {
}),
})
it('gets cycle that has only one day', () => {
test('gets cycle that has only one day', () => {
const result = getCycleForDay('2018-07-05', '2018-08-01')
expect(result.length).to.eql(1)
expect(result).to.eql([
expect(result.length).toEqual(1)
expect(result).toEqual([
{
date: '2018-07-05',
bleeding: { value: 2 },
},
])
const result2 = getCycleForDay('2018-06-05')
expect(result2.length).to.eql(1)
expect(result2).to.eql([
expect(result2.length).toEqual(1)
expect(result2).toEqual([
{
date: '2018-06-05',
bleeding: { value: 2 },
@@ -68,10 +67,10 @@ describe('getCycleForDay', () => {
])
})
it('for later date gets cycle that has only one day', () => {
test('for later date gets cycle that has only one day', () => {
const result = getCycleForDay('2018-06-20')
expect(result.length).to.eql(1)
expect(result).to.eql([
expect(result.length).toEqual(1)
expect(result).toEqual([
{
date: '2018-06-05',
bleeding: { value: 2 },
@@ -79,12 +78,12 @@ describe('getCycleForDay', () => {
])
})
it('returns null if there is no cycle start for that date', () => {
test('returns null if there is no cycle start for that date', () => {
const result = getCycleForDay('2018-04-01')
expect(result).to.eql(null)
expect(result).toBeNull()
})
it('returns null if the cycle is longer than the max', () => {
test('returns null if the cycle is longer than the max', () => {
const { getCycleForDay } = cycleModule({
cycleDaysSortedByDate,
cycleStartsSortedByDate: cycleDaysSortedByDate.filter((d) => {
@@ -93,13 +92,13 @@ describe('getCycleForDay', () => {
maxCycleLength: 3,
})
const result = getCycleForDay('2018-04-04')
expect(result).to.eql(null)
expect(result).toBeNull()
})
it('gets cycle for day', () => {
test('gets cycle for day', () => {
const result = getCycleForDay('2018-04-04')
expect(result.length).to.eql(4)
expect(result).to.eql([
expect(result.length).toEqual(4)
expect(result).toEqual([
{
date: '2018-04-05',
mucus: { value: 2 },