UNPKG

@cainiaofe/cn-ui-m

Version:
25 lines (24 loc) 1.14 kB
import { dayjs } from "../../../../utils/dayjs"; import { getStartOfQuarter } from '../get-start-of-quarter'; describe('getStartOfQuarter', function () { it('should return the start of the first quarter', function () { var date = dayjs('2023-02-15'); var result = getStartOfQuarter(date); expect(result.format('YYYY-MM-DD HH:mm:ss')).toBe('2023-01-01 00:00:00'); }); it('should return the start of the second quarter', function () { var date = dayjs('2023-05-10'); var result = getStartOfQuarter(date); expect(result.format('YYYY-MM-DD HH:mm:ss')).toBe('2023-04-01 00:00:00'); }); it('should return the start of the third quarter', function () { var date = dayjs('2023-08-20'); var result = getStartOfQuarter(date); expect(result.format('YYYY-MM-DD HH:mm:ss')).toBe('2023-07-01 00:00:00'); }); it('should return the start of the fourth quarter', function () { var date = dayjs('2023-11-25'); var result = getStartOfQuarter(date); expect(result.format('YYYY-MM-DD HH:mm:ss')).toBe('2023-10-01 00:00:00'); }); });