Rename files, update tests
This commit is contained in:
parent
786aca82f1
commit
ca2f7a763d
12 changed files with 409 additions and 6 deletions
|
@ -1,6 +1,6 @@
|
|||
import { render } from "@testing-library/react";
|
||||
import App, { GlobalStyle } from "../app";
|
||||
import { IThemeProps } from "../lib/theme";
|
||||
import { IThemeProps } from "../lib/useTheme";
|
||||
|
||||
const props: IThemeProps = {
|
||||
label: "Classic",
|
||||
|
|
19
src/test/components/__snapshots__/apps.spec.tsx.snap
Normal file
19
src/test/components/__snapshots__/apps.spec.tsx.snap
Normal file
|
@ -0,0 +1,19 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`app.tsx Tests App rendering with newTab 1`] = `[Function]`;
|
||||
|
||||
exports[`app.tsx Tests App rendering with newTab 2`] = `[Function]`;
|
||||
|
||||
exports[`app.tsx Tests App rendering without newTab 1`] = `[Function]`;
|
||||
|
||||
exports[`app.tsx Tests AppCategory rendering 1`] = `[Function]`;
|
||||
|
||||
exports[`app.tsx Tests AppCategory rendering 2`] = `[Function]`;
|
||||
|
||||
exports[`app.tsx Tests AppList rendering 1`] = `[Function]`;
|
||||
|
||||
exports[`app.tsx Tests AppList rendering 2`] = `[Function]`;
|
||||
|
||||
exports[`app.tsx Tests AppList rendering 3`] = `[Function]`;
|
||||
|
||||
exports[`app.tsx Tests AppList rendering 4`] = `[Function]`;
|
99
src/test/components/apps.spec.tsx
Normal file
99
src/test/components/apps.spec.tsx
Normal file
|
@ -0,0 +1,99 @@
|
|||
import { render } from "@testing-library/react";
|
||||
import {
|
||||
App,
|
||||
AppCategory,
|
||||
AppList,
|
||||
IAppProps,
|
||||
IAppCategoryProps,
|
||||
IAppListProps,
|
||||
} from "../../components/apps";
|
||||
|
||||
const appProps: IAppProps = {
|
||||
name: "App Test",
|
||||
icon: "bug_report",
|
||||
url: "#",
|
||||
displayURL: "test",
|
||||
};
|
||||
|
||||
const appCategoryProps: Array<IAppCategoryProps> = [
|
||||
{
|
||||
name: "Test",
|
||||
items: [appProps, appProps],
|
||||
},
|
||||
{
|
||||
name: "",
|
||||
items: [appProps, appProps],
|
||||
},
|
||||
];
|
||||
|
||||
const appListProps: Array<IAppListProps> = [
|
||||
{
|
||||
categories: appCategoryProps,
|
||||
apps: [appProps, appProps],
|
||||
},
|
||||
{
|
||||
apps: undefined,
|
||||
categories: appCategoryProps,
|
||||
},
|
||||
{
|
||||
apps: [appProps, appProps],
|
||||
categories: undefined,
|
||||
},
|
||||
{
|
||||
apps: undefined,
|
||||
categories: undefined,
|
||||
},
|
||||
];
|
||||
|
||||
describe("app.tsx", () => {
|
||||
it("Tests App rendering with newTab", () => {
|
||||
const tests = [true, false];
|
||||
|
||||
tests.forEach((test: boolean) => {
|
||||
const { asFragment } = render(
|
||||
<App
|
||||
name={appProps.name}
|
||||
icon={appProps.icon}
|
||||
url={appProps.url}
|
||||
displayURL={appProps.displayURL}
|
||||
newTab={test}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(asFragment).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
it("Tests App rendering without newTab", () => {
|
||||
const { asFragment } = render(
|
||||
<App
|
||||
name={appProps.name}
|
||||
icon={appProps.icon}
|
||||
url={appProps.url}
|
||||
displayURL={appProps.displayURL}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(asFragment).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("Tests AppCategory rendering", () => {
|
||||
appCategoryProps.forEach((appCategory) => {
|
||||
const { asFragment } = render(
|
||||
<AppCategory name={appCategory.name} items={appCategory.items} />,
|
||||
);
|
||||
|
||||
expect(asFragment).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
||||
it("Tests AppList rendering", () => {
|
||||
appListProps.forEach((appList) => {
|
||||
const { asFragment } = render(
|
||||
<AppList apps={appList.apps} categories={appList.categories} />,
|
||||
);
|
||||
|
||||
expect(asFragment).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
});
|
|
@ -9,7 +9,7 @@ import Settings, {
|
|||
SectionHeadline,
|
||||
} from "../../components/settings";
|
||||
import { ISearchProps } from "../../components/searchBar";
|
||||
import { IThemeProps } from "../../lib/theme";
|
||||
import { IThemeProps } from "../../lib/useTheme";
|
||||
|
||||
const themes: Array<IThemeProps> = [
|
||||
{
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
import { getTheme, IThemeProps, setTheme } from "../../lib/theme";
|
||||
import { getTheme, IThemeProps, setTheme } from "../../lib/useTheme";
|
||||
|
||||
const props: IThemeProps = {
|
||||
label: "Classic",
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue