Added tests

This commit is contained in:
phntxx 2021-06-14 11:29:03 +02:00
parent 753a55c9c1
commit 24e61efcf1
30 changed files with 2089 additions and 1737 deletions

View file

@ -0,0 +1,24 @@
import { render } from "@testing-library/react";
import App, { IAppProps } from "../../components/app";
const props: IAppProps = {
name: "App Test",
icon: "bug_report",
url: "#",
displayURL: "test",
newTab: false,
};
it("should take a snapshot", () => {
const { asFragment } = render(
<App
name={props.name}
icon={props.icon}
url={props.url}
displayURL={props.displayURL}
newTab={props.newTab}
/>,
);
expect(asFragment).toMatchSnapshot();
});

View file

@ -0,0 +1,30 @@
import { render } from "@testing-library/react";
import AppCategory, { IAppCategoryProps } from "../../components/appCategory";
const props: IAppCategoryProps = {
name: "Category Test",
items: [
{
name: "App Test",
icon: "bug_report",
url: "#",
displayURL: "test",
newTab: false,
},
{
name: "App Test",
icon: "bug_report",
url: "#",
displayURL: "test",
newTab: false,
},
],
};
it("should take a snapshot", () => {
const { asFragment } = render(
<AppCategory name={props.name} items={props.items} />,
);
expect(asFragment).toMatchSnapshot();
});

View file

@ -0,0 +1,43 @@
import { render } from "@testing-library/react";
import AppList, { IAppListProps } from "../../components/appList";
const props: IAppListProps = {
categories: [
{
name: "Category Test",
items: [
{
name: "App Test",
icon: "bug_report",
url: "#",
displayURL: "test",
newTab: false,
},
{
name: "App Test",
icon: "bug_report",
url: "#",
displayURL: "test",
newTab: false,
},
],
},
],
apps: [
{
name: "App Test",
icon: "bug_report",
url: "#",
displayURL: "test",
newTab: false,
},
],
};
it("should take a snapshot", () => {
const { asFragment } = render(
<AppList categories={props.categories} apps={props.apps} />,
);
expect(asFragment).toMatchSnapshot();
});

View file

@ -0,0 +1,39 @@
import { render } from "@testing-library/react";
import BookmarkList, {
BookmarkGroup,
IBookmarkGroupProps,
IBookmarkListProps,
} from "../../components/bookmarks";
const bookmarkGroupProps: IBookmarkGroupProps = {
name: "Test Group",
items: [
{
name: "Bookmark Test",
url: "#",
},
],
};
const bookmarkListProps: IBookmarkListProps = {
groups: [bookmarkGroupProps, bookmarkGroupProps],
};
it("BookmarkGroup snapshot test", () => {
const { asFragment } = render(
<BookmarkGroup
name={bookmarkGroupProps.name}
items={bookmarkGroupProps.items}
/>,
);
expect(asFragment).toMatchSnapshot();
});
it("BookmarkList snapshot test", () => {
const { asFragment } = render(
<BookmarkList groups={bookmarkListProps.groups} />,
);
expect(asFragment).toMatchSnapshot();
});