Created
August 11, 2017 13:36
-
-
Save antonybudianto/2d099a023cc1c6b072169a7bf52db467 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
import React from 'react'; | |
import ReactDOM from 'react-dom'; | |
import { mount } from 'enzyme'; | |
import { MemoryRouter } from 'react-router'; | |
import LandingPage from './LandingPage/LandingPage'; | |
import NotFoundPage from './ErrorPage/NotFoundPage/NotFoundPage'; | |
import App from './App'; | |
jest.mock('firebase/app'); | |
test('invalid path should redirect to 404', () => { | |
const wrapper = mount( | |
<MemoryRouter initialEntries={[ '/random' ]}> | |
<App/> | |
</MemoryRouter> | |
); | |
expect(wrapper.find(LandingPage)).toHaveLength(0); | |
expect(wrapper.find(NotFoundPage)).toHaveLength(1); | |
}); | |
test('valid path should not redirect to 404', () => { | |
const wrapper = mount( | |
<MemoryRouter initialEntries={[ '/' ]}> | |
<App/> | |
</MemoryRouter> | |
); | |
expect(wrapper.find(LandingPage)).toHaveLength(1); | |
expect(wrapper.find(NotFoundPage)).toHaveLength(0); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment