Skip to content

Commit

Permalink
feat: add series test
Browse files Browse the repository at this point in the history
  • Loading branch information
anderson-oki committed Jan 24, 2025
1 parent 93039ec commit 66e8b9a
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 0 deletions.
1 change: 1 addition & 0 deletions frontend/src/pages/Blacklist/Movies/index.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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: [
{
Expand Down
62 changes: 62 additions & 0 deletions frontend/src/pages/Blacklist/Series/index.test.tsx
Original file line number Diff line number Diff line change
@@ -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(<BlacklistSeriesView />);

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(<BlacklistSeriesView />);

await waitFor(() => {
expect(screen.getByText("animetosho")).toBeInTheDocument();
});
});
});

0 comments on commit 66e8b9a

Please sign in to comment.