feat(stats): add TMDB metadata for live-action dramas in the Library (#252)

This commit is contained in:
sudacode authored and GitHub committed 2026-09-21 00:10:00 -07:00
1 parent 4dd30f44d1
commit 1508863dbb
76 files changed
+3595 -238

No files matched your search

@@ -49,6 +49,8 @@ function libraryItem(anilistId: number | null): AnimeLibraryItem {
animeId: 7,
canonicalTitle: 'Test Anime Season 2',
anilistId,
tmdbId: null,
tmdbType: null,
totalSessions: 1,
totalActiveMs: 1000,
totalCards: 0,
@@ -66,6 +68,8 @@ function detailData(anilistId: number | null): AnimeDetailData {
animeId: 7,
canonicalTitle: 'Test Anime Season 2',
anilistId,
tmdbId: null,
tmdbType: null,
titleRomaji: null,
titleEnglish: null,
titleNative: null,
@@ -180,6 +184,43 @@ test('AnimeTab refetches the library after the AniList entry is relinked', async
}
});
test('AnimeTab watch time follows the displayed kind filter', async () => {
const uninstallDom = installDom();
const original = apiClient.getAnimeLibrary;
apiClient.getAnimeLibrary = async () => [
{ ...libraryItem(42), totalActiveMs: 3600000 },
{
...libraryItem(null),
animeId: 8,
canonicalTitle: 'Drama',
mediaKind: 'live_action',
tmdbId: 12,
tmdbType: 'tv',
totalActiveMs: 7200000,
},
];
const container = document.createElement('div');
document.body.append(container);
const root = createRoot(container);
try {
await act(async () => {
root.render(<AnimeTab />);
});
assert.match(container.textContent ?? '', /2 titles · 3h/);
await act(async () => {
findButton(container, 'Live Action').click();
});
assert.match(container.textContent ?? '', /1 title · 2h/);
assert.equal(findButton(container, 'Live Action').getAttribute('aria-pressed'), 'true');
} finally {
await act(async () => {
root.unmount();
});
apiClient.getAnimeLibrary = original;
uninstallDom();
}
});
test('Library kind filter separates YouTube channels from anime and updates totals', async () => {
const uninstallDom = installDom();
const original = {