Client - init calendar on Dashboard

This commit is contained in:
Sam
2021-09-05 17:43:14 +02:00
parent a85860581f
commit 2ae2cf04d5
23 changed files with 500 additions and 22 deletions

View File

@ -1,6 +1,6 @@
import { assert, expect } from 'chai'
import { incrementDate, startDate } from '@/utils/dates'
import { getCalendarStartAndEnd, incrementDate, startDate } from '@/utils/dates'
describe('startDate (week starting Sunday)', () => {
const testsParams = [
@ -135,3 +135,23 @@ describe('dateIncrement', () => {
)
})
})
describe('getCalendarStartAndEnd', () => {
const testsParams = [
{
description: 'returns empty string if no date provided',
inputDate: 'September 5, 2021 20:00:00',
expectedStartDate: 'August 29, 2021 00:00:00',
expectedEndDate: 'October 2, 2021 23:59:59.999',
},
]
testsParams.map((testParams) =>
it(testParams.description, () => {
const date: Date = new Date(testParams.inputDate)
const results = getCalendarStartAndEnd(date, false)
assert.deepEqual(results.start, new Date(testParams.expectedStartDate))
assert.deepEqual(results.end, new Date(testParams.expectedEndDate))
})
)
})