From b6dca1ae033e613d8e692f9a161a3cc53a5a2857 Mon Sep 17 00:00:00 2001
From: shamoon <4887959+shamoon@users.noreply.github.com>
Date: Wed, 12 Aug 2026 17:12:22 -0700
Subject: [PATCH] Add coverage for that other jellyfin line
---
src/widgets/jellyfin/component.test.jsx | 28 ++++++++++++++++---------
1 file changed, 18 insertions(+), 10 deletions(-)
diff --git a/src/widgets/jellyfin/component.test.jsx b/src/widgets/jellyfin/component.test.jsx
index 5b6cc114e..fabcd1609 100644
--- a/src/widgets/jellyfin/component.test.jsx
+++ b/src/widgets/jellyfin/component.test.jsx
@@ -90,20 +90,28 @@ describe("widgets/jellyfin/component", () => {
expect(screen.getByText(/01:00/)).toBeInTheDocument();
});
- it("renders optional albums field when included", () => {
+ it("renders the optional albums field and caps configured fields at four", () => {
useWidgetAPI
.mockReturnValueOnce({ data: [], error: undefined, mutate: vi.fn() }) // sessions
- .mockImplementation(() => ({
+ .mockReturnValueOnce({
data: { MovieCount: 1, SeriesCount: 2, EpisodeCount: 3, SongCount: 4, AlbumCount: 5 },
error: undefined,
- }));
+ }); // count
- renderWithProviders(
- ,
- );
+ const service = {
+ widget: {
+ type: "jellyfin",
+ url: "http://x",
+ enableBlocks: true,
+ fields: ["movies", "series", "episodes", "albums", "songs"],
+ },
+ };
+
+ renderWithProviders();
+
+ expect(service.widget.fields).toEqual(["movies", "series", "episodes", "albums"]);
+ expect(screen.getByText("jellyfin.albums")).toBeInTheDocument();
+ expect(screen.getByText("5")).toBeInTheDocument();
+ expect(screen.queryByText("jellyfin.songs")).not.toBeInTheDocument();
});
});