@lion/calendar
Version:
Standalone calendar
18 lines (16 loc) • 678 B
JavaScript
import { expect } from '@open-wc/testing';
import { isSameDate } from '../../src/utils/isSameDate.js';
import { getLastDayPreviousMonth } from '../../src/utils/getLastDayPreviousMonth.js';
describe('getLastDayPreviousMonth', () => {
it('returns the last day of the previous month', () => {
expect(
isSameDate(getLastDayPreviousMonth(new Date('2001/01/01')), new Date('2000/12/31')),
).to.equal(true);
expect(
isSameDate(getLastDayPreviousMonth(new Date('2001/10/10')), new Date('2001/09/30')),
).to.equal(true);
expect(
isSameDate(getLastDayPreviousMonth(new Date('2000/03/10')), new Date('2000/02/29')),
).to.equal(true);
});
});