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",
|
"version": "1.0.0",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"repository": "git@github.com:phntxx/dashboard",
|
"repository": "git@github.com:phntxx/dashboard",
|
||||||
"contributors": [
|
"contributors": ["phntxx <hello@phntxx.com>"],
|
||||||
"phntxx <hello@phntxx.com>"
|
|
||||||
],
|
|
||||||
"private": false,
|
"private": false,
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@types/node": "^14.14.37",
|
"@types/node": "^14.14.37",
|
||||||
|
@ -36,7 +34,7 @@
|
||||||
"start": "react-scripts start",
|
"start": "react-scripts start",
|
||||||
"build": "react-scripts build",
|
"build": "react-scripts build",
|
||||||
"coverage": "codecov -f coverage/*.json -F dashboard",
|
"coverage": "codecov -f coverage/*.json -F dashboard",
|
||||||
"test": "react-scripts test",
|
"test": "react-scripts test --watchAll --coverage --runInBand",
|
||||||
"typecheck": "tsc --noEmit",
|
"typecheck": "tsc --noEmit",
|
||||||
"eject": "react-scripts eject",
|
"eject": "react-scripts eject",
|
||||||
"lint": "eslint --config .eslintrc.js",
|
"lint": "eslint --config .eslintrc.js",
|
||||||
|
@ -49,11 +47,7 @@
|
||||||
"extends": "react-app"
|
"extends": "react-app"
|
||||||
},
|
},
|
||||||
"browserslist": {
|
"browserslist": {
|
||||||
"production": [
|
"production": [">0.2%", "not dead", "not op_mini all"],
|
||||||
">0.2%",
|
|
||||||
"not dead",
|
|
||||||
"not op_mini all"
|
|
||||||
],
|
|
||||||
"development": [
|
"development": [
|
||||||
"last 1 chrome version",
|
"last 1 chrome version",
|
||||||
"last 1 firefox version",
|
"last 1 firefox version",
|
||||||
|
|
|
@ -10,7 +10,7 @@ import Imprint from "./components/imprint";
|
||||||
import selectedTheme from "./lib/theme";
|
import selectedTheme from "./lib/theme";
|
||||||
import useFetcher from "./lib/fetcher";
|
import useFetcher from "./lib/fetcher";
|
||||||
|
|
||||||
const GlobalStyle = createGlobalStyle`
|
export const GlobalStyle = createGlobalStyle`
|
||||||
body {
|
body {
|
||||||
background-color: ${selectedTheme.backgroundColor};
|
background-color: ${selectedTheme.backgroundColor};
|
||||||
font-family: Roboto, sans-serif;
|
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
|
// 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",
|
icon: "bug_report",
|
||||||
url: "#",
|
url: "#",
|
||||||
displayURL: "test",
|
displayURL: "test",
|
||||||
newTab: false,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
it("App snapshot test", () => {
|
describe("app.tsx", () => {
|
||||||
const { asFragment } = render(
|
it("Tests app rendering with newTab=true", () => {
|
||||||
<App
|
const { asFragment } = render(
|
||||||
name={props.name}
|
<App
|
||||||
icon={props.icon}
|
name={props.name}
|
||||||
url={props.url}
|
icon={props.icon}
|
||||||
displayURL={props.displayURL}
|
url={props.url}
|
||||||
newTab={props.newTab}
|
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