Update tests
This commit is contained in:
parent
b95f9667ed
commit
7cccbd5095
6 changed files with 61 additions and 23 deletions
12
package.json
12
package.json
|
@ -3,9 +3,7 @@
|
|||
"version": "1.0.0",
|
||||
"license": "MIT",
|
||||
"repository": "git@github.com:phntxx/dashboard",
|
||||
"contributors": [
|
||||
"phntxx <hello@phntxx.com>"
|
||||
],
|
||||
"contributors": ["phntxx <hello@phntxx.com>"],
|
||||
"private": false,
|
||||
"dependencies": {
|
||||
"@types/node": "^14.14.37",
|
||||
|
@ -36,7 +34,7 @@
|
|||
"start": "react-scripts start",
|
||||
"build": "react-scripts build",
|
||||
"coverage": "codecov -f coverage/*.json -F dashboard",
|
||||
"test": "react-scripts test",
|
||||
"test": "react-scripts test --watchAll --coverage --runInBand",
|
||||
"typecheck": "tsc --noEmit",
|
||||
"eject": "react-scripts eject",
|
||||
"lint": "eslint --config .eslintrc.js",
|
||||
|
@ -49,11 +47,7 @@
|
|||
"extends": "react-app"
|
||||
},
|
||||
"browserslist": {
|
||||
"production": [
|
||||
">0.2%",
|
||||
"not dead",
|
||||
"not op_mini all"
|
||||
],
|
||||
"production": [">0.2%", "not dead", "not op_mini all"],
|
||||
"development": [
|
||||
"last 1 chrome version",
|
||||
"last 1 firefox version",
|
||||
|
|
|
@ -10,7 +10,7 @@ import Imprint from "./components/imprint";
|
|||
import selectedTheme from "./lib/theme";
|
||||
import useFetcher from "./lib/fetcher";
|
||||
|
||||
const GlobalStyle = createGlobalStyle`
|
||||
export const GlobalStyle = createGlobalStyle`
|
||||
body {
|
||||
background-color: ${selectedTheme.backgroundColor};
|
||||
font-family: Roboto, sans-serif;
|
||||
|
|
3
src/test/__snapshots__/app.spec.tsx.snap
Normal file
3
src/test/__snapshots__/app.spec.tsx.snap
Normal file
|
@ -0,0 +1,3 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`app.tsx Tests GlobalStyle 1`] = `[Function]`;
|
9
src/test/app.spec.tsx
Normal file
9
src/test/app.spec.tsx
Normal file
|
@ -0,0 +1,9 @@
|
|||
import { render } from "@testing-library/react";
|
||||
import App, { GlobalStyle } from "../app";
|
||||
|
||||
describe("app.tsx", () => {
|
||||
it("Tests GlobalStyle", () => {
|
||||
const { asFragment } = render(<GlobalStyle />);
|
||||
expect(asFragment).toMatchSnapshot();
|
||||
});
|
||||
});
|
|
@ -1,3 +1,7 @@
|
|||
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||
|
||||
exports[`App snapshot test 1`] = `[Function]`;
|
||||
exports[`app.tsx Tests app rendering with newTab=false 1`] = `[Function]`;
|
||||
|
||||
exports[`app.tsx Tests app rendering with newTab=true 1`] = `[Function]`;
|
||||
|
||||
exports[`app.tsx Tests app rendering without newTab 1`] = `[Function]`;
|
||||
|
|
|
@ -6,19 +6,47 @@ const props: IAppProps = {
|
|||
icon: "bug_report",
|
||||
url: "#",
|
||||
displayURL: "test",
|
||||
newTab: false,
|
||||
};
|
||||
|
||||
it("App snapshot test", () => {
|
||||
const { asFragment } = render(
|
||||
<App
|
||||
name={props.name}
|
||||
icon={props.icon}
|
||||
url={props.url}
|
||||
displayURL={props.displayURL}
|
||||
newTab={props.newTab}
|
||||
/>,
|
||||
);
|
||||
describe("app.tsx", () => {
|
||||
it("Tests app rendering with newTab=true", () => {
|
||||
const { asFragment } = render(
|
||||
<App
|
||||
name={props.name}
|
||||
icon={props.icon}
|
||||
url={props.url}
|
||||
displayURL={props.displayURL}
|
||||
newTab={true}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(asFragment).toMatchSnapshot();
|
||||
expect(asFragment).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("Tests app rendering with newTab=false", () => {
|
||||
const { asFragment } = render(
|
||||
<App
|
||||
name={props.name}
|
||||
icon={props.icon}
|
||||
url={props.url}
|
||||
displayURL={props.displayURL}
|
||||
newTab={false}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(asFragment).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("Tests app rendering without newTab", () => {
|
||||
const { asFragment } = render(
|
||||
<App
|
||||
name={props.name}
|
||||
icon={props.icon}
|
||||
url={props.url}
|
||||
displayURL={props.displayURL}
|
||||
/>,
|
||||
);
|
||||
|
||||
expect(asFragment).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue