mirror of
https://github.com/gethomepage/homepage.git
synced 2026-05-19 03:49:14 +08:00
Chore: merge Overseerr into Seerr, add aliases (#6330)
Some checks failed
Docker CI / Linting Checks (push) Has been cancelled
Docker CI / Docker Build & Push (push) Has been cancelled
Tests / vitest (1) (push) Has been cancelled
Tests / vitest (2) (push) Has been cancelled
Tests / vitest (3) (push) Has been cancelled
Tests / vitest (4) (push) Has been cancelled
Crowdin Action / Crowdin Sync (push) Has been cancelled
Some checks failed
Docker CI / Linting Checks (push) Has been cancelled
Docker CI / Docker Build & Push (push) Has been cancelled
Tests / vitest (1) (push) Has been cancelled
Tests / vitest (2) (push) Has been cancelled
Tests / vitest (3) (push) Has been cancelled
Tests / vitest (4) (push) Has been cancelled
Crowdin Action / Crowdin Sync (push) Has been cancelled
This commit is contained in:
@@ -30,9 +30,59 @@ describe("widgets/seerr/component", () => {
|
||||
expect(screen.getByText("seerr.approved")).toBeInTheDocument();
|
||||
expect(screen.getByText("seerr.completed")).toBeInTheDocument();
|
||||
expect(screen.queryByText("seerr.available")).toBeNull();
|
||||
expect(screen.queryByText("seerr.processing")).toBeNull();
|
||||
expect(screen.queryByText("seerr.issues")).toBeNull();
|
||||
});
|
||||
|
||||
it("supports jellyseerr as a legacy alias to seerr", () => {
|
||||
useWidgetAPI
|
||||
.mockReturnValueOnce({ data: undefined, error: undefined }) // request/count
|
||||
.mockReturnValueOnce({ data: undefined, error: undefined }); // issue/count disabled (endpoint = "")
|
||||
|
||||
const service = { widget: { type: "jellyseerr", url: "http://x" } };
|
||||
const { container } = renderWithProviders(<Component service={service} />, { settings: { hideErrors: false } });
|
||||
|
||||
expect(service.widget.fields).toEqual(seerrDefaultFields);
|
||||
expect(useWidgetAPI.mock.calls[1][1]).toBe("");
|
||||
expect(container.querySelectorAll(".service-block")).toHaveLength(3);
|
||||
expect(screen.getByText("seerr.pending")).toBeInTheDocument();
|
||||
expect(screen.getByText("seerr.approved")).toBeInTheDocument();
|
||||
expect(screen.getByText("seerr.completed")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("supports overseerr as a legacy alias with the same default fields", () => {
|
||||
useWidgetAPI
|
||||
.mockReturnValueOnce({ data: undefined, error: undefined }) // request/count
|
||||
.mockReturnValueOnce({ data: undefined, error: undefined }); // issue/count disabled (endpoint = "")
|
||||
|
||||
const service = { widget: { type: "overseerr", url: "http://x" } };
|
||||
const { container } = renderWithProviders(<Component service={service} />, { settings: { hideErrors: false } });
|
||||
|
||||
expect(service.widget.fields).toEqual(seerrDefaultFields);
|
||||
expect(useWidgetAPI.mock.calls[1][1]).toBe("");
|
||||
expect(container.querySelectorAll(".service-block")).toHaveLength(3);
|
||||
expect(screen.getByText("seerr.pending")).toBeInTheDocument();
|
||||
expect(screen.getByText("seerr.approved")).toBeInTheDocument();
|
||||
expect(screen.getByText("seerr.completed")).toBeInTheDocument();
|
||||
});
|
||||
|
||||
it("keeps processing as a separate optional field", () => {
|
||||
useWidgetAPI
|
||||
.mockReturnValueOnce({ data: { pending: 1, processing: 2, approved: 3, available: 4 }, error: undefined })
|
||||
.mockReturnValueOnce({ data: undefined, error: undefined }); // issue/count disabled (endpoint = "")
|
||||
|
||||
const service = {
|
||||
widget: { type: "overseerr", url: "http://x", fields: ["pending", "processing", "approved", "available"] },
|
||||
};
|
||||
const { container } = renderWithProviders(<Component service={service} />, { settings: { hideErrors: false } });
|
||||
|
||||
expect(useWidgetAPI.mock.calls[1][1]).toBe("");
|
||||
expect(container.querySelectorAll(".service-block")).toHaveLength(4);
|
||||
expect(screen.getByText("seerr.processing")).toBeInTheDocument();
|
||||
expect(screen.getByText("2")).toBeInTheDocument();
|
||||
expect(screen.queryByText("seerr.completed")).toBeNull();
|
||||
});
|
||||
|
||||
it("renders issues when enabled (and calls the issue/count endpoint)", () => {
|
||||
useWidgetAPI
|
||||
.mockReturnValueOnce({ data: { pending: 1, approved: 2, available: 3, completed: 4 }, error: undefined })
|
||||
|
||||
Reference in New Issue
Block a user