Skip to content
This repository has been archived by the owner on Nov 2, 2023. It is now read-only.

Commit

Permalink
Merge pull request #12 from dcmpa/dev
Browse files Browse the repository at this point in the history
Merge Tests Update PR Template
  • Loading branch information
koolamusic authored Oct 21, 2018
2 parents ae9378d + a247b0d commit 2a17ccd
Show file tree
Hide file tree
Showing 13 changed files with 1,609 additions and 32 deletions.
1 change: 1 addition & 0 deletions .github/PULL_REQUEST_TEMPLATE
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
<!--- Provide a general summary of your changes in the Title above, describing your changes in detail -->
<!--- List any dependencies that are required for this change -->
<!--- Make sure to checkout our CODE_OF_CONDUCT and PULL_REQUEST guidelines in the CONTRIBUTING.md file -->
<!--- VERY IMPORTANT -- ALWAYS MAKE YOUR PRs TO THE `dev` branch -->

## Motivation and Context
<!--- Why is this change required? What problem does it solve? -->
Expand Down
6 changes: 6 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@
"start": "react-scripts start",
"build": "react-scripts build",
"test": "react-scripts test --env=jsdom",
"test:watch": "react-scripts test --env=jsdom --watch",
"eject": "react-scripts eject"
},
"devDependencies": {
"enzyme": "^3.7.0",
"enzyme-adapter-react-16": "^1.6.0",
"enzyme-to-json": "^3.3.4"
}
}
9 changes: 0 additions & 9 deletions src/App.test.js

This file was deleted.

35 changes: 35 additions & 0 deletions src/__tests__/App.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
import React from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';

jest.mock('../components/About');
jest.mock('../components/Archive');
jest.mock('../components/Home');
jest.mock('../components/Login');
jest.mock('../components/Signup');
jest.mock('../components/ResetPassword');
jest.mock('../components/FourOhFour');

import App from '../AppRouter';
import About from '../components/About';
About.mockReturnValue(() => <div />);
import Archive from '../components/Archive';
Archive.mockReturnValue(() => <div />);
import Home from '../components/Home';
Home.mockReturnValue(() => <div />);
import Login from '../components/Login';
Login.mockReturnValue(() => <div />);
import Signup from '../components/Signup';
Signup.mockReturnValue(() => <div />);
import ResetPassword from '../components/ResetPassword';
ResetPassword.mockReturnValue(() => <div />);
import FourOhFour from '../components/FourOhFour';
FourOhFour.mockReturnValue(() => <div />);

describe('Test AppRouter.js', () => {
it('Component Rendered', () => {
const wrapper = shallow(<App />);
expect(wrapper).toBeTruthy();
expect(toJson(wrapper)).toMatchSnapshot();
});
});
38 changes: 38 additions & 0 deletions src/__tests__/__snapshots__/App.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Test AppRouter.js Component Rendered 1`] = `
<BrowserRouter>
<section>
<Switch>
<Route
component={[Function]}
exact={true}
path="/"
/>
<Route
component={[Function]}
path="/about"
/>
<Route
component={[Function]}
path="/archive"
/>
<Route
component={[Function]}
path="/login"
/>
<Route
component={[Function]}
path="/signup"
/>
<Route
component={[Function]}
path="/resetpass"
/>
<Route
component={[Function]}
/>
</Switch>
</section>
</BrowserRouter>
`;
3 changes: 3 additions & 0 deletions src/components/ResetPassword.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import React from 'react';

export default () => <div />;
3 changes: 3 additions & 0 deletions src/components/Signup.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import React from 'react';

export default () => <div />;
12 changes: 12 additions & 0 deletions src/components/__tests__/About.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import About from '../About';

describe('Test About.js', () => {
it('Component Rendered', () => {
const wrapper = shallow(<About />);
expect(wrapper).toBeTruthy();
expect(toJson(wrapper)).toMatchSnapshot();
});
});
12 changes: 12 additions & 0 deletions src/components/__tests__/Archive.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import React from 'react';
import { shallow } from 'enzyme';
import toJson from 'enzyme-to-json';
import Archive from '../Archive';

describe('Test Archive.js', () => {
it('Component Rendered', () => {
const wrapper = shallow(<Archive />);
expect(wrapper).toBeTruthy();
expect(toJson(wrapper)).toMatchSnapshot();
});
});
49 changes: 49 additions & 0 deletions src/components/__tests__/__snapshots__/About.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Test About.js Component Rendered 1`] = `
<section>
<HeaderLite />
<div
className="App"
>
<header
className="App-header pt-2 p-5"
>
<h1
className="App-title text-white pt-5"
>
About the Missing Person's Project
</h1>
<p
className="pl-md-5 pr-md-5"
>
This platform will maintain an archive of all information which is published within its domain, users can query the database to search for current cases, un-resolved and resolved cases, and see if there is a law enforcement handler on any of the cases.
</p>
</header>
</div>
<Container
tag="div"
>
<div
className="mt-5 mb-4 d-flex flex-wrap flex-row offset-md-1 text-center"
>
<PreFooter
alt="learn how we work"
heading="Who we Are"
image="document.svg"
/>
<PreFooter
alt="report a case"
heading="Report a Sighting"
image="report.svg"
/>
<PreFooter
alt="donate and contribute"
heading="Support Us"
image="hands.svg"
/>
</div>
</Container>
<Footer />
</section>
`;
17 changes: 17 additions & 0 deletions src/components/__tests__/__snapshots__/Archive.test.js.snap
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Test Archive.js Component Rendered 1`] = `
<div
className="App"
>
<header
className="App-header"
>
<h1
className="App-title"
>
Welcome to Archive Page
</h1>
</header>
</div>
`;
4 changes: 4 additions & 0 deletions src/setupTests.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
import { configure } from 'enzyme';
import Adapter from 'enzyme-adapter-react-16';

configure({ adapter: new Adapter() });
Loading

0 comments on commit 2a17ccd

Please sign in to comment.