Refactor calendar methods into util class (#3088)

Refactored some methods in calendar module:
- move methods into own file 
- dont call shorten method from titelTransform because why? just call
them after each other.
- added tests for util methods
- cleaned up other tests

---------

Co-authored-by: veeck <michael@veeck.de>
This commit is contained in:
Veeck
2023-04-09 12:49:50 +02:00
committed by GitHub
parent dee3cd3da7
commit 77f9c86774
11 changed files with 787 additions and 757 deletions

View File

@@ -11,7 +11,7 @@ const ical = require("node-ical");
const fetch = require("fetch");
const Log = require("logger");
const NodeHelper = require("node_helper");
const CalendarUtils = require("./calendarutils");
const CalendarFetcherUtils = require("./calendarfetcherutils");
/**
*
@@ -72,7 +72,7 @@ const CalendarFetcher = function (url, reloadInterval, excludedEvents, maximumEn
try {
data = ical.parseICS(responseData);
Log.debug(`parsed data=${JSON.stringify(data)}`);
events = CalendarUtils.filterEvents(data, {
events = CalendarFetcherUtils.filterEvents(data, {
excludedEvents,
includePastEvents,
maximumEntries,