mirror of
https://github.com/gethomepage/homepage.git
synced 2026-09-26 14:01:16 -07:00
Add coverage for that other jellyfin line
This commit is contained in:
@@ -90,20 +90,28 @@ describe("widgets/jellyfin/component", () => {
|
|||||||
expect(screen.getByText(/01:00/)).toBeInTheDocument();
|
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
|
useWidgetAPI
|
||||||
.mockReturnValueOnce({ data: [], error: undefined, mutate: vi.fn() }) // sessions
|
.mockReturnValueOnce({ data: [], error: undefined, mutate: vi.fn() }) // sessions
|
||||||
.mockImplementation(() => ({
|
.mockReturnValueOnce({
|
||||||
data: { MovieCount: 1, SeriesCount: 2, EpisodeCount: 3, SongCount: 4, AlbumCount: 5 },
|
data: { MovieCount: 1, SeriesCount: 2, EpisodeCount: 3, SongCount: 4, AlbumCount: 5 },
|
||||||
error: undefined,
|
error: undefined,
|
||||||
}));
|
}); // count
|
||||||
|
|
||||||
renderWithProviders(
|
const service = {
|
||||||
<Component
|
widget: {
|
||||||
service={{
|
type: "jellyfin",
|
||||||
widget: { type: "jellyfin", url: "http://x", fields: ["movies", "series", "episodes", "albums"] },
|
url: "http://x",
|
||||||
}}
|
enableBlocks: true,
|
||||||
/>,
|
fields: ["movies", "series", "episodes", "albums", "songs"],
|
||||||
);
|
},
|
||||||
|
};
|
||||||
|
|
||||||
|
renderWithProviders(<Component service={service} />);
|
||||||
|
|
||||||
|
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();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user