@qntm-code/utils
Version:
A collection of useful utility functions with associated TypeScript types. All functions have been unit tested.
16 lines (15 loc) • 712 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
const __1 = require("../..");
describe('setStartOfWeek', () => {
it('milliseconds, seconds, minutes, and hour should be set to 0 and day to first day of week', () => {
const value = new Date(2020, 8, 3, 15, 31, 22, 123);
const expected = new Date(2020, 7, 31, 0, 0, 0, 0);
expect((0, __1.setStartOfWeek)(value)).toEqual(expected);
});
it('On a Sunday it should go back Monday of same week', () => {
const value = new Date(2020, 7, 30, 15, 31, 22, 123);
const expected = new Date(2020, 7, 24, 0, 0, 0, 0);
expect((0, __1.setStartOfWeek)(value)).toEqual(expected);
});
});