diff --git a/.eslintrc.js b/.eslintrc.js index 3b141c5..7ef76b0 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -22,7 +22,6 @@ module.exports = { globals: { Atomics: 'readonly', SharedArrayBuffer: 'readonly', - SharedArrayBuffer: 'readonly', shallow: true, mount: true, expect: true, diff --git a/__mocks__/fileMock.js b/__mocks__/fileMock.js deleted file mode 100644 index f053ebf..0000000 --- a/__mocks__/fileMock.js +++ /dev/null @@ -1 +0,0 @@ -module.exports = {}; diff --git a/__test__/App.spec.js b/__test__/App.spec.js new file mode 100644 index 0000000..7282448 --- /dev/null +++ b/__test__/App.spec.js @@ -0,0 +1,85 @@ +import React from 'react'; +import { createStore, combineReducers } from 'redux'; +import { BrowserRouter, Switch } from 'react-router-dom'; +import { Provider } from 'react-redux'; +import auth from '@modules/auth/reducer'; +import LoginPage from '@pages/loginPage'; +import HomePage from '@pages/homePage'; +import NotFoundPage from '@pages/notFoundPage'; +import Menu from '../src/components/userMenu'; +import Footer from '../src/components/Footer/index'; +import App from '../src/routes/AppRouter'; + +describe('Application test', () => { + let store; + + beforeEach(() => { + store = createStore( + combineReducers({ + auth + }) + ); + }); + it('should render index page', () => { + const comp = ( + + + + + + + + ); + const wrapper = mount(comp); + + expect(wrapper.find('Home')).toBeTruthy(); + }); + it('should not crash app', () => { + const wrapper = mount(); + + expect(toJson(wrapper)).toMatchSnapshot(); + }); + it('should work fine on Login Page', () => { + const wrapper = mount( + + + + ); + + expect(toJson(wrapper)).toMatchSnapshot(); + }); + it('should work fine Home Page', () => { + const wrapper = mount( + + + + ); + + expect(toJson(wrapper)).toMatchSnapshot(); + }); + + it('should work fine Home Page', () => { + const wrapper = mount( + + + + ); + + expect(toJson(wrapper)).toMatchSnapshot(); + }); + + it('should render without crashing', () => { + const wrapper = mount(); + + expect(toJson(wrapper)).toMatchSnapshot(); + expect(wrapper.find('[href="/"]')).toHaveLength(4); + expect(wrapper.find('a').length).toBeGreaterThan(1); + expect(wrapper.find('ul')).toHaveLength(1); + expect(wrapper.find('li').length).toBeGreaterThan(1); + }); + it('should render without crashing', () => { + const wrapper = shallow(