-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
some events are fetched but should not be shown (api issue?) (#281)
- Loading branch information
Showing
3 changed files
with
66 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
import { findActiveEvents } from './findActiveEvents'; | ||
|
||
import type { CalendarEvent } from './calendarEvents'; | ||
|
||
describe(`findActiveEvents`, () => { | ||
test(`filter events which starts not in range but recived by api`, () => { | ||
const data = [ | ||
{ | ||
date: { | ||
start: new Date('2024-03-29T23:00:00.000Z'), | ||
end: new Date('2024-03-30T23:00:00.000Z') | ||
}, | ||
isWholeDayEvent: true, | ||
content: { | ||
summary: 'refuse bin', | ||
description: null, | ||
location: null, | ||
uid: null, | ||
recurrence_id: null, | ||
rrule: null, | ||
entity: 'calendar.portsmouth_city_council' | ||
} | ||
}, | ||
{ | ||
date: { | ||
start: new Date('2024-03-29T23:00:00.000Z'), | ||
end: new Date('2024-03-30T23:00:00.000Z') | ||
}, | ||
isWholeDayEvent: true, | ||
content: { | ||
summary: 'food waste bin', | ||
description: '', | ||
location: null, | ||
uid: 'removed when posted', | ||
recurrence_id: '20240401', | ||
rrule: 'FREQ=WEEKLY;BYDAY=MO', | ||
entity: 'calendar.home_assistant_calendar' | ||
} | ||
} | ||
]; | ||
|
||
const result = findActiveEvents(data as CalendarEvent[], { | ||
config: { | ||
filter_events: false, | ||
pattern: [] | ||
}, | ||
dropAfter: false, | ||
now: new Date('2024-03-29T12:09:08.879Z'), | ||
filterFutureEventsDay: '2024-03-29' | ||
}); | ||
|
||
expect(result).toEqual([]); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters