-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
132 additions
and
44 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
import React from 'react'; | ||
import { Button } from 'react-bootstrap'; | ||
import PropTypes from 'prop-types'; | ||
|
||
function PageNotFound(props) { | ||
const { history } = props; | ||
const { push } = history; | ||
|
||
return ( | ||
<section className="page_404"> | ||
<div className="container"> | ||
<div className="four_zero_four_bg"> | ||
<h1 className="text-center ">404</h1> | ||
</div> | ||
|
||
<div className="contant_box_404"> | ||
<h3 className="h2">Looks like you are lost</h3> | ||
|
||
<p>We dont have the page you are looking for</p> | ||
<Button | ||
className="btn-one" | ||
onClick={() => { | ||
push('/'); | ||
}} | ||
> | ||
Go home | ||
</Button> | ||
</div> | ||
</div> | ||
</section> | ||
); | ||
} | ||
PageNotFound.propTypes = { | ||
history: PropTypes.shape.isRequired, | ||
}; | ||
|
||
export default PageNotFound; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
|
||
import React from 'react'; | ||
import { shallow } from 'enzyme'; | ||
import PageNotFound from '../../components/404'; | ||
import configureMockStore from 'redux-mock-store'; | ||
import thunk from 'redux-thunk'; | ||
|
||
|
||
const props = { | ||
history: { | ||
push: jest.fn(), | ||
}, | ||
isRegister: true, | ||
}; | ||
jest.mock('react-router-dom/BrowserRouter', () => ({ children }) => <div>{children}</div>); | ||
|
||
test('invalid path should redirect to 404', () => { | ||
const wrapper = shallow(<PageNotFound {...props} />); | ||
expect(wrapper.find(PageNotFound)).toHaveLength(0); | ||
}); |