feat: Add unit-tests #25

Merged
timharek merged 31 commits from feature-testing into main 2024-04-11 19:10:16 +00:00
1 changed files with 2 additions and 2 deletions
Showing only changes of commit 5c6a3eff4e - Show all commits

View File

@ -37,13 +37,13 @@ async function updateFetch(existingSeries: Series): Promise<UpdatedSeries | null
* we should not make assumptions about the order, * we should not make assumptions about the order,
* but rather sort the episode to what we want. * but rather sort the episode to what we want.
*/ */
const episodesSorted = [...newEpisodes, ...existingSeries.episodes] const episodesSortedDescending = [...newEpisodes, ...existingSeries.episodes]
.sort((a, b) => a.date.getTime() > b.date.getTime() ? -1 : 1); .sort((a, b) => a.date.getTime() > b.date.getTime() ? -1 : 1);
const updated = { const updated = {
...existingSeries, ...existingSeries,
lastFetch: new Date(), lastFetch: new Date(),
episodes: episodesSorted, episodes: episodesSortedDescending,
}; };
const updateSuccessful = await storage.write(updated); const updateSuccessful = await storage.write(updated);