From 66e8b9a7f431a2d610ee86996cda76878197b4b1 Mon Sep 17 00:00:00 2001 From: Anderson Shindy Oki Date: Fri, 24 Jan 2025 10:38:45 +0900 Subject: [PATCH] feat: add series test --- .../src/pages/Blacklist/Movies/index.test.tsx | 1 + .../src/pages/Blacklist/Series/index.test.tsx | 62 +++++++++++++++++++ 2 files changed, 63 insertions(+) create mode 100644 frontend/src/pages/Blacklist/Series/index.test.tsx diff --git a/frontend/src/pages/Blacklist/Movies/index.test.tsx b/frontend/src/pages/Blacklist/Movies/index.test.tsx index c39f02895..3fad35fcf 100644 --- a/frontend/src/pages/Blacklist/Movies/index.test.tsx +++ b/frontend/src/pages/Blacklist/Movies/index.test.tsx @@ -9,6 +9,7 @@ describe("Blacklist Movies", () => { it("should render with blacklisted movies", async () => { server.use( http.get("/api/movies/blacklist", () => { + // TODO: Replace with Factory return HttpResponse.json({ data: [ { diff --git a/frontend/src/pages/Blacklist/Series/index.test.tsx b/frontend/src/pages/Blacklist/Series/index.test.tsx new file mode 100644 index 000000000..1d3ac5b12 --- /dev/null +++ b/frontend/src/pages/Blacklist/Series/index.test.tsx @@ -0,0 +1,62 @@ +import { http } from "msw"; +import { HttpResponse } from "msw"; +import { render, screen, waitFor } from "@/tests"; +import server from "@/tests/mocks/node"; +import BlacklistSeriesView from "."; + +/* eslint-disable camelcase */ +describe("Blacklist Series", () => { + it("should render without blacklisted series", async () => { + server.use( + http.get("/api/episodes/blacklist", () => { + return HttpResponse.json({ + data: [], + }); + }), + ); + + render(); + + await waitFor(() => { + expect( + screen.getByText("No blacklisted series subtitles"), + ).toBeInTheDocument(); + }); + }); + + it("should render with blacklisted series", async () => { + server.use( + http.get("/api/episodes/blacklist", () => { + // TODO: Replace with Factory + return HttpResponse.json({ + data: [ + { + seriesTitle: "Dragon Ball DAIMA", + episode_number: "1x14", + episodeTitle: "Taboo", + sonarrSeriesId: 56, + provider: "animetosho", + subs_id: + "https://animetosho.org/storage/attach/0022fd50/2293072.xz", + language: { + name: "English", + code2: "en", + code3: "eng", + forced: false, + hi: false, + }, + timestamp: "now", + parsed_timestamp: "01/24/25 01:38:03", + }, + ], + }); + }), + ); + + render(); + + await waitFor(() => { + expect(screen.getByText("animetosho")).toBeInTheDocument(); + }); + }); +});