|
1 | | -xdescribe('<Applications />', () => { |
2 | | - it('should'); |
| 1 | +import React from 'react'; |
| 2 | +import { mount } from 'enzyme'; |
| 3 | +import { createMount, createShallow } from '@material-ui/core/test-utils'; |
| 4 | + |
| 5 | +import Applications from '../../../app/components/Applications'; |
| 6 | +import { DashboardContext } from '../../../app/context/DashboardContext'; |
| 7 | + |
| 8 | +describe('React unit tests', () => { |
| 9 | + describe('<Application/>', () => { |
| 10 | + let wrapper: any; |
| 11 | + let mount: any; |
| 12 | + let shallow: any; |
| 13 | + |
| 14 | + beforeAll(() => { |
| 15 | + const applications: any = []; |
| 16 | + const getApplications: any = jest.fn(); |
| 17 | + mount = createMount(); |
| 18 | + shallow = createShallow(); |
| 19 | + |
| 20 | + wrapper = mount( |
| 21 | + <DashboardContext.Provider value={{ applications, getApplications }}> |
| 22 | + <Applications /> |
| 23 | + </DashboardContext.Provider> |
| 24 | + ); |
| 25 | + }); |
| 26 | + |
| 27 | + afterAll(() => { |
| 28 | + mount.cleanUp(); |
| 29 | + }); |
| 30 | + |
| 31 | + it('should render properly', () => { |
| 32 | + expect(wrapper).toMatchSnapshot(); |
| 33 | + }); |
| 34 | + }); |
3 | 35 | }); |
4 | | - |
5 | | - |
6 | | -// import React from 'react'; |
7 | | -// import { configure, shallow, mount } from 'enzyme'; |
8 | | -// import { expect } from 'chai'; |
9 | | -// import { createShallow } from '@material-ui/core/test-utils'; |
10 | | -// import Adapter from 'enzyme-adapter-react-16'; |
11 | | - |
12 | | -// // Import our Component and Icons |
13 | | -// import Applications from '../../../app/components/Applications'; |
14 | | -// import DeleteForeverOutlinedIcon from '@material-ui/icons/DeleteForeverOutlined'; |
15 | | - |
16 | | -// configure({ adapter: new Adapter() }); |
17 | | - |
18 | | -// describe('React unit tests', () => { |
19 | | -// describe('<Applications />', () => { |
20 | | -// let wrapper; |
21 | | - |
22 | | -// beforeAll(() => { |
23 | | -// wrapper = shallow(<Applications />); |
24 | | -// // shallow = createShallow(); |
25 | | -// }); |
26 | | - |
27 | | -// xit('Should render a delete icon', () => { |
28 | | -// // expect(wrapper.find(<DeleteForeverOutlinedIcon />)); |
29 | | -// }); |
30 | | - |
31 | | -// xit('Should have delete functionality', () => {}); |
32 | | - |
33 | | -// xit('Should contain grid items', () => {}); |
34 | | - |
35 | | -// xit('Should have three grid items', () => { |
36 | | -// const wrapper = shallow(<Applications />); |
37 | | -// expect(wrapper.toHaveLength(3)); |
38 | | -// }); |
39 | | -// }); |
40 | | -// }); |
0 commit comments