mirror of
https://github.com/morpheus65535/bazarr.git
synced 2025-06-28 09:24:56 -04:00
test(system-providers): add tests for rendering providers and their states
This commit is contained in:
parent
7db5164cc1
commit
7145e1a036
1 changed files with 37 additions and 3 deletions
|
@ -1,11 +1,47 @@
|
||||||
import { http } from "msw";
|
import { http } from "msw";
|
||||||
import { HttpResponse } from "msw";
|
import { HttpResponse } from "msw";
|
||||||
import { customRender } from "@/tests";
|
import { customRender, screen, waitFor } from "@/tests";
|
||||||
import server from "@/tests/mocks/node";
|
import server from "@/tests/mocks/node";
|
||||||
import SystemProvidersView from ".";
|
import SystemProvidersView from ".";
|
||||||
|
|
||||||
describe("System Providers", () => {
|
describe("System Providers", () => {
|
||||||
it("should render with providers", async () => {
|
it("should render with providers", async () => {
|
||||||
|
server.use(
|
||||||
|
http.get("/api/providers", () => {
|
||||||
|
return HttpResponse.json({
|
||||||
|
data: [
|
||||||
|
{ name: "OpenSubtitles", status: "active", retry: "0" },
|
||||||
|
{ name: "Subscene", status: "inactive", retry: "3" },
|
||||||
|
{ name: "Addic7ed", status: "disabled", retry: "1" },
|
||||||
|
],
|
||||||
|
});
|
||||||
|
}),
|
||||||
|
);
|
||||||
|
|
||||||
|
customRender(<SystemProvidersView />);
|
||||||
|
|
||||||
|
await waitFor(() => {
|
||||||
|
expect(screen.getByText("OpenSubtitles")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
expect(screen.getByText("OpenSubtitles")).toBeInTheDocument();
|
||||||
|
expect(screen.getByText("Subscene")).toBeInTheDocument();
|
||||||
|
expect(screen.getByText("Addic7ed")).toBeInTheDocument();
|
||||||
|
|
||||||
|
expect(screen.getByText("active")).toBeInTheDocument();
|
||||||
|
expect(screen.getByText("inactive")).toBeInTheDocument();
|
||||||
|
expect(screen.getByText("disabled")).toBeInTheDocument();
|
||||||
|
|
||||||
|
expect(screen.getByText("0")).toBeInTheDocument();
|
||||||
|
expect(screen.getByText("3")).toBeInTheDocument();
|
||||||
|
expect(screen.getByText("1")).toBeInTheDocument();
|
||||||
|
|
||||||
|
// Verify toolbar buttons are present
|
||||||
|
expect(screen.getByText("Refresh")).toBeInTheDocument();
|
||||||
|
expect(screen.getByText("Reset")).toBeInTheDocument();
|
||||||
|
});
|
||||||
|
|
||||||
|
it("should render with no providers", async () => {
|
||||||
server.use(
|
server.use(
|
||||||
http.get("/api/providers", () => {
|
http.get("/api/providers", () => {
|
||||||
return HttpResponse.json({
|
return HttpResponse.json({
|
||||||
|
@ -15,7 +51,5 @@ describe("System Providers", () => {
|
||||||
);
|
);
|
||||||
|
|
||||||
customRender(<SystemProvidersView />);
|
customRender(<SystemProvidersView />);
|
||||||
|
|
||||||
// TODO: Assert
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue