parent
415a2e13d3
commit
85e4796e0b
@ -1,14 +1,9 @@
|
||||
import { render } from "@/tests";
|
||||
import { StrictMode } from "react";
|
||||
import { describe, it } from "vitest";
|
||||
import App from ".";
|
||||
|
||||
describe("App", () => {
|
||||
it("should render without crash", () => {
|
||||
render(
|
||||
<StrictMode>
|
||||
<App />
|
||||
</StrictMode>
|
||||
);
|
||||
render(<App />);
|
||||
});
|
||||
});
|
||||
|
@ -0,0 +1,16 @@
|
||||
import { renderTest, RenderTestCase } from "@/tests/render";
|
||||
import BlacklistMoviesView from "./Movies";
|
||||
import BlacklistSeriesView from "./Series";
|
||||
|
||||
const cases: RenderTestCase[] = [
|
||||
{
|
||||
name: "movie page",
|
||||
ui: BlacklistMoviesView,
|
||||
},
|
||||
{
|
||||
name: "series page",
|
||||
ui: BlacklistSeriesView,
|
||||
},
|
||||
];
|
||||
|
||||
renderTest("Blacklist", cases);
|
@ -0,0 +1,21 @@
|
||||
import { renderTest, RenderTestCase } from "@/tests/render";
|
||||
import MoviesHistoryView from "./Movies";
|
||||
import SeriesHistoryView from "./Series";
|
||||
import HistoryStats from "./Statistics";
|
||||
|
||||
const cases: RenderTestCase[] = [
|
||||
{
|
||||
name: "movie page",
|
||||
ui: MoviesHistoryView,
|
||||
},
|
||||
{
|
||||
name: "series page",
|
||||
ui: SeriesHistoryView,
|
||||
},
|
||||
{
|
||||
name: "statistics page",
|
||||
ui: HistoryStats,
|
||||
},
|
||||
];
|
||||
|
||||
renderTest("History", cases);
|
@ -0,0 +1,16 @@
|
||||
import { render } from "@/tests";
|
||||
import { describe } from "vitest";
|
||||
import MovieView from ".";
|
||||
import MovieMassEditor from "./Editor";
|
||||
|
||||
describe("Movies page", () => {
|
||||
it("should render", () => {
|
||||
render(<MovieView />);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Movies editor page", () => {
|
||||
it("should render", () => {
|
||||
render(<MovieMassEditor />);
|
||||
});
|
||||
});
|
@ -0,0 +1,16 @@
|
||||
import { render } from "@/tests";
|
||||
import { describe } from "vitest";
|
||||
import SeriesView from ".";
|
||||
import SeriesMassEditor from "./Editor";
|
||||
|
||||
describe("Series page", () => {
|
||||
it("should render", () => {
|
||||
render(<SeriesView />);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Series editor page", () => {
|
||||
it("should render", () => {
|
||||
render(<SeriesMassEditor />);
|
||||
});
|
||||
});
|
@ -0,0 +1,51 @@
|
||||
import { renderTest, RenderTestCase } from "@/tests/render";
|
||||
import SettingsGeneralView from "./General";
|
||||
import SettingsLanguagesView from "./Languages";
|
||||
import SettingsNotificationsView from "./Notifications";
|
||||
import SettingsProvidersView from "./Providers";
|
||||
import SettingsRadarrView from "./Radarr";
|
||||
import SettingsSchedulerView from "./Scheduler";
|
||||
import SettingsSonarrView from "./Sonarr";
|
||||
import SettingsSubtitlesView from "./Subtitles";
|
||||
import SettingsUIView from "./UI";
|
||||
|
||||
const cases: RenderTestCase[] = [
|
||||
{
|
||||
name: "general page",
|
||||
ui: SettingsGeneralView,
|
||||
},
|
||||
{
|
||||
name: "languages page",
|
||||
ui: SettingsLanguagesView,
|
||||
},
|
||||
{
|
||||
name: "notifications page",
|
||||
ui: SettingsNotificationsView,
|
||||
},
|
||||
{
|
||||
name: "providers page",
|
||||
ui: SettingsProvidersView,
|
||||
},
|
||||
{
|
||||
name: "radarr page",
|
||||
ui: SettingsRadarrView,
|
||||
},
|
||||
{
|
||||
name: "scheduler page",
|
||||
ui: SettingsSchedulerView,
|
||||
},
|
||||
{
|
||||
name: "sonarr page",
|
||||
ui: SettingsSonarrView,
|
||||
},
|
||||
{
|
||||
name: "subtitles page",
|
||||
ui: SettingsSubtitlesView,
|
||||
},
|
||||
{
|
||||
name: "ui page",
|
||||
ui: SettingsUIView,
|
||||
},
|
||||
];
|
||||
|
||||
renderTest("Settings", cases);
|
@ -0,0 +1,36 @@
|
||||
import { renderTest, RenderTestCase } from "@/tests/render";
|
||||
import SystemBackupsView from "./Backups";
|
||||
import SystemLogsView from "./Logs";
|
||||
import SystemProvidersView from "./Providers";
|
||||
import SystemReleasesView from "./Releases";
|
||||
import SystemStatusView from "./Status";
|
||||
import SystemTasksView from "./Tasks";
|
||||
|
||||
const cases: RenderTestCase[] = [
|
||||
{
|
||||
name: "backups page",
|
||||
ui: SystemBackupsView,
|
||||
},
|
||||
{
|
||||
name: "logs page",
|
||||
ui: SystemLogsView,
|
||||
},
|
||||
{
|
||||
name: "providers page",
|
||||
ui: SystemProvidersView,
|
||||
},
|
||||
{
|
||||
name: "releases page",
|
||||
ui: SystemReleasesView,
|
||||
},
|
||||
{
|
||||
name: "status page",
|
||||
ui: SystemStatusView,
|
||||
},
|
||||
{
|
||||
name: "tasks page",
|
||||
ui: SystemTasksView,
|
||||
},
|
||||
];
|
||||
|
||||
renderTest("System", cases);
|
@ -0,0 +1,16 @@
|
||||
import { renderTest, RenderTestCase } from "@/tests/render";
|
||||
import WantedMoviesView from "./Movies";
|
||||
import WantedSeriesView from "./Series";
|
||||
|
||||
const cases: RenderTestCase[] = [
|
||||
{
|
||||
name: "movie page",
|
||||
ui: WantedMoviesView,
|
||||
},
|
||||
{
|
||||
name: "series page",
|
||||
ui: WantedSeriesView,
|
||||
},
|
||||
];
|
||||
|
||||
renderTest("Wanted", cases);
|
@ -0,0 +1,22 @@
|
||||
import { render } from "@/tests";
|
||||
import CriticalError from "./CriticalError";
|
||||
import NotFound from "./NotFound";
|
||||
import UIError from "./UIError";
|
||||
|
||||
describe("Not found page", () => {
|
||||
it("should display message", () => {
|
||||
render(<NotFound />);
|
||||
});
|
||||
});
|
||||
|
||||
describe("Critical error page", () => {
|
||||
it("should disable error", () => {
|
||||
render(<CriticalError message="Test error"></CriticalError>);
|
||||
});
|
||||
});
|
||||
|
||||
describe("UI error page", () => {
|
||||
it("should disable error", () => {
|
||||
render(<UIError error={new Error("Test error")}></UIError>);
|
||||
});
|
||||
});
|
@ -0,0 +1,17 @@
|
||||
import { FunctionComponent } from "react";
|
||||
import { render } from ".";
|
||||
|
||||
export interface RenderTestCase {
|
||||
name: string;
|
||||
ui: FunctionComponent;
|
||||
}
|
||||
|
||||
export function renderTest(name: string, cases: RenderTestCase[]) {
|
||||
describe(name, () => {
|
||||
cases.forEach((element) => {
|
||||
it(`${element.name.toLowerCase()} should render`, () => {
|
||||
render(<element.ui />);
|
||||
});
|
||||
});
|
||||
});
|
||||
}
|
Loading…
Reference in new issue