Unit tests for App,Header,Inbox,MyTask,Dashboard components
This commit is contained in:
@@ -19,7 +19,7 @@
|
|||||||
work correctly both with client-side routing and a non-root public URL.
|
work correctly both with client-side routing and a non-root public URL.
|
||||||
Learn how to configure a non-root public URL by running `npm run build`.
|
Learn how to configure a non-root public URL by running `npm run build`.
|
||||||
-->
|
-->
|
||||||
<title>React App</title>
|
<title>Sutask io</title>
|
||||||
</head>
|
</head>
|
||||||
<body>
|
<body>
|
||||||
<noscript>
|
<noscript>
|
||||||
|
|||||||
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"short_name": "React App",
|
"short_name": "Subtask IO",
|
||||||
"name": "Create React App Sample",
|
"name": "Subtask",
|
||||||
"icons": [
|
"icons": [
|
||||||
{
|
{
|
||||||
"src": "favicon.ico",
|
"src": "favicon.ico",
|
||||||
|
|||||||
@@ -1,9 +1,10 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import ReactDOM from 'react-dom';
|
import ReactDOM from 'react-dom';
|
||||||
|
import {MemoryRouter as Router} from 'react-router-dom'
|
||||||
import App from './index';
|
import App from './index';
|
||||||
|
|
||||||
it('renders without crashing', () => {
|
it('renders without crashing', () => {
|
||||||
const div = document.createElement('div');
|
const div = document.createElement('div');
|
||||||
ReactDOM.render(<App />, div);
|
ReactDOM.render(<Router><App/></Router>, div);
|
||||||
ReactDOM.unmountComponentAtNode(div);
|
ReactDOM.unmountComponentAtNode(div);
|
||||||
});
|
});
|
||||||
|
|||||||
@@ -0,0 +1,41 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`Dummy renders correctly 1`] = `
|
||||||
|
<div
|
||||||
|
className={undefined}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={undefined}
|
||||||
|
>
|
||||||
|
<h1>
|
||||||
|
SUBTASK
|
||||||
|
</h1>
|
||||||
|
<div
|
||||||
|
className={undefined}
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
className={undefined}
|
||||||
|
href="/mytask"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
My Task
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
className={undefined}
|
||||||
|
href="/inbox"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
Inbox
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
className={undefined}
|
||||||
|
href="/dashboard"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
Dashboard
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
Dashboard
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
@@ -1,5 +1,5 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {BrowserRouter as Router} from 'react-router-dom'
|
import {MemoryRouter as Router} from 'react-router-dom'
|
||||||
import Dashboard from './index';
|
import Dashboard from './index';
|
||||||
import renderer from 'react-test-renderer';
|
import renderer from 'react-test-renderer';
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,36 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`Dummy renders correctly 1`] = `
|
||||||
|
<div
|
||||||
|
className={undefined}
|
||||||
|
>
|
||||||
|
<h1>
|
||||||
|
SUBTASK
|
||||||
|
</h1>
|
||||||
|
<div
|
||||||
|
className={undefined}
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
className={undefined}
|
||||||
|
href="/mytask"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
My Task
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
className={undefined}
|
||||||
|
href="/inbox"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
Inbox
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
className={undefined}
|
||||||
|
href="/dashboard"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
Dashboard
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {MemoryRouter as Router} from 'react-router-dom'
|
||||||
|
import Header from './index';
|
||||||
|
import renderer from 'react-test-renderer';
|
||||||
|
|
||||||
|
test('Dummy renders correctly', () => {
|
||||||
|
const component = renderer.create(
|
||||||
|
<Router><Header/></Router>,
|
||||||
|
);
|
||||||
|
let tree = component.toJSON();
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
@@ -1,11 +1,15 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import {Link } from 'react-router-dom'
|
import { Link } from 'react-router-dom'
|
||||||
|
import styles from './styles.scss';
|
||||||
|
|
||||||
const Header = () => {
|
const Header = () => {
|
||||||
return <div>
|
return <div className={styles.Header}>
|
||||||
<Link to="/mytask">My Task</Link>
|
<h1>SUBTASK</h1>
|
||||||
<Link to="/inbox">Inbox</Link>
|
<div className={styles.HeaderContainer}>
|
||||||
<Link to="/dashboard">Dashboard</Link>
|
<Link className={styles.HeaderContainer} to="/mytask">My Task</Link>
|
||||||
|
<Link className={styles.HeaderContainer} to="/inbox">Inbox</Link>
|
||||||
|
<Link className={styles.HeaderContainer} to="/dashboard">Dashboard</Link>
|
||||||
|
</div>
|
||||||
</div>;
|
</div>;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
.Header {
|
||||||
|
padding-top : 12px;
|
||||||
|
padding-bottom : 12px;
|
||||||
|
display: flex;
|
||||||
|
justify-content: space-between;
|
||||||
|
align-items:center;
|
||||||
|
display: flex;
|
||||||
|
margin-left: 8px;
|
||||||
|
margin-right: 8px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.HeaderContainer {
|
||||||
|
padding: 10px;
|
||||||
|
}
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`Dummy renders correctly 1`] = `
|
||||||
|
<div
|
||||||
|
className={undefined}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={undefined}
|
||||||
|
>
|
||||||
|
<h1>
|
||||||
|
SUBTASK
|
||||||
|
</h1>
|
||||||
|
<div
|
||||||
|
className={undefined}
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
className={undefined}
|
||||||
|
href="/mytask"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
My Task
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
className={undefined}
|
||||||
|
href="/inbox"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
Inbox
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
className={undefined}
|
||||||
|
href="/dashboard"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
Dashboard
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
Inbox
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {MemoryRouter as Router} from 'react-router-dom'
|
||||||
|
import Inbox from './index';
|
||||||
|
import renderer from 'react-test-renderer';
|
||||||
|
|
||||||
|
test('Dummy renders correctly', () => {
|
||||||
|
const component = renderer.create(
|
||||||
|
<Router><Inbox/></Router>,
|
||||||
|
);
|
||||||
|
let tree = component.toJSON();
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
@@ -0,0 +1,41 @@
|
|||||||
|
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
||||||
|
|
||||||
|
exports[`Dummy renders correctly 1`] = `
|
||||||
|
<div
|
||||||
|
className={undefined}
|
||||||
|
>
|
||||||
|
<div
|
||||||
|
className={undefined}
|
||||||
|
>
|
||||||
|
<h1>
|
||||||
|
SUBTASK
|
||||||
|
</h1>
|
||||||
|
<div
|
||||||
|
className={undefined}
|
||||||
|
>
|
||||||
|
<a
|
||||||
|
className={undefined}
|
||||||
|
href="/mytask"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
My Task
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
className={undefined}
|
||||||
|
href="/inbox"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
Inbox
|
||||||
|
</a>
|
||||||
|
<a
|
||||||
|
className={undefined}
|
||||||
|
href="/dashboard"
|
||||||
|
onClick={[Function]}
|
||||||
|
>
|
||||||
|
Dashboard
|
||||||
|
</a>
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
My Task
|
||||||
|
</div>
|
||||||
|
`;
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
import React from 'react';
|
||||||
|
import {MemoryRouter as Router} from 'react-router-dom'
|
||||||
|
import MyTask from './index';
|
||||||
|
import renderer from 'react-test-renderer';
|
||||||
|
|
||||||
|
test('Dummy renders correctly', () => {
|
||||||
|
const component = renderer.create(
|
||||||
|
<Router><MyTask/></Router>,
|
||||||
|
);
|
||||||
|
let tree = component.toJSON();
|
||||||
|
expect(tree).toMatchSnapshot();
|
||||||
|
});
|
||||||
Reference in New Issue
Block a user