diff options
| author | Fuwn <[email protected]> | 2026-06-05 14:48:42 +0000 |
|---|---|---|
| committer | Fuwn <[email protected]> | 2026-06-05 14:48:42 +0000 |
| commit | 577be4ea3440c258689a560d3d1a6c2ae158592b (patch) | |
| tree | 763f658f5d785d64be43e2432052ec18e1e45f8f /src/lib/Media/Anime/Airing/classify.test.ts | |
| parent | feat(schedule): add native track alongside sub and dub (diff) | |
| download | due.moe-577be4ea3440c258689a560d3d1a6c2ae158592b.tar.xz due.moe-577be4ea3440c258689a560d3d1a6c2ae158592b.zip | |
nextReleaseTime kept a just-aired release in the past for 5 minutes, showing a negative countdown and driving scheduleAiringRefresh into a 1-second revalidate loop. Always roll a past release to its next occurrence, and only arm the refresh timer on future airings.
Diffstat (limited to 'src/lib/Media/Anime/Airing/classify.test.ts')
| -rw-r--r-- | src/lib/Media/Anime/Airing/classify.test.ts | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/lib/Media/Anime/Airing/classify.test.ts b/src/lib/Media/Anime/Airing/classify.test.ts index eeff2036..7b3aea32 100644 --- a/src/lib/Media/Anime/Airing/classify.test.ts +++ b/src/lib/Media/Anime/Airing/classify.test.ts @@ -210,6 +210,30 @@ describe("countdown source fallback", () => { }); }); +describe("release timing", () => { + it("rolls a just-aired release forward instead of returning a past time", () => { + clearInjectAiringTimeCache(); + + const media = baseMedia(170019); + const justAired = Math.floor(Date.now() / 1000) - 3 * 60; + + media.nextAiringEpisode = { + episode: 10, + airingAt: justAired + 12 * 60 * 60, + }; + + const schedule = subScheduleFor(media, justAired); + + settings.setKey("countdownSource", "sub"); + + const injected = injectAiringTime(media, schedule); + + expect(injected.nextAiringEpisode?.airingAt).toBeGreaterThan( + Date.now() / 1000, + ); + }); +}); + describe("injectAiringTime cache safety", () => { it("does not let caller mutation poison cached injected media", () => { const media = baseMedia(444444); |