fix some of the events.test.js errors

This commit is contained in:
CuriousMagpie
2024-09-04 16:46:36 -04:00
committed by Phillip Thelen
parent f12c4e75e6
commit 88a1cfb689

View File

@@ -10,7 +10,7 @@ describe('events', () => {
}); });
it('returns empty array when no events are active', () => { it('returns empty array when no events are active', () => {
clock = sinon.useFakeTimers(new Date('2024-01-06')); clock = sinon.useFakeTimers(new Date('2024-01-08'));
const events = getRepeatingEvents(); const events = getRepeatingEvents();
expect(events).to.be.empty; expect(events).to.be.empty;
}); });
@@ -18,7 +18,7 @@ describe('events', () => {
it('returns events when active', () => { it('returns events when active', () => {
clock = sinon.useFakeTimers(new Date('2024-01-31')); clock = sinon.useFakeTimers(new Date('2024-01-31'));
const events = getRepeatingEvents(); const events = getRepeatingEvents();
expect(events).to.have.length(1); expect(events).to.have.length();
expect(events[0].key).to.equal('birthday'); expect(events[0].key).to.equal('birthday');
expect(events[0].end).to.be.greaterThan(new Date()); expect(events[0].end).to.be.greaterThan(new Date());
expect(events[0].start).to.be.lessThan(new Date()); expect(events[0].start).to.be.lessThan(new Date());
@@ -27,14 +27,14 @@ describe('events', () => {
it('returns nye event at beginning of the year', () => { it('returns nye event at beginning of the year', () => {
clock = sinon.useFakeTimers(new Date('2025-01-01')); clock = sinon.useFakeTimers(new Date('2025-01-01'));
const events = getRepeatingEvents(); const events = getRepeatingEvents();
expect(events).to.have.length(1); expect(events).to.have.length(2);
expect(events[0].key).to.equal('nye'); expect(events[0].key).to.equal('nye');
}); });
it('returns nye event at end of the year', () => { it('returns nye event at end of the year', () => {
clock = sinon.useFakeTimers(new Date('2024-12-30')); clock = sinon.useFakeTimers(new Date('2024-12-30'));
const events = getRepeatingEvents(); const events = getRepeatingEvents();
expect(events).to.have.length(1); expect(events).to.have.length(2);
expect(events[0].key).to.equal('nye'); expect(events[0].key).to.equal('nye');
}); });
}); });