Skip to content

Commit 017fbb9

Browse files
committed
starting to implement enzyme tests
1 parent 6ab7090 commit 017fbb9

File tree

6 files changed

+33
-11
lines changed

6 files changed

+33
-11
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ Download for [MacOS](https://github.com/team-reactype/ReacType/releases), [Windo
2929

3030
- **Linux users**: run the application as a super user in order to read and write files.
3131

32-
![Gif of adding](https://i.imgur.com/hdVTFcP.gif)
32+
![Gif of adding](https://i.imgur.com/nOeuuU6.gif)
3333

3434
### How to use
3535

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Enzyme testing suite renders snapshots, too 1`] = `
4+
<div>
5+
<h1>
6+
Hello, Enzyme!
7+
</h1>
8+
</div>
9+
`;

__tests__/enzyme.test.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { shallow } from 'enzyme';
2+
import React from 'react';
3+
4+
describe('Enzyme testing suite', () => {
5+
6+
it('renders snapshots, too', () => {
7+
const wrapper = shallow(<div>
8+
<h1>Hello, Enzyme!</h1>
9+
</div>)
10+
expect(wrapper).toMatchSnapshot()
11+
})
12+
})

app/setupTests.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
import { configure } from 'enzyme'
2+
import Adapter from 'enzyme-adapter-react-16'
3+
4+
configure({
5+
adapter: new Adapter(),
6+
})

app/src/setupTests.ts

Lines changed: 0 additions & 7 deletions
This file was deleted.

package.json

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,8 @@
7171
"diagnostics": false
7272
}
7373
},
74-
"testTimeout": 50000
74+
"setupFilesAfterEnv": ["<rootDir>/app/setupTests.ts"],
75+
"snapshotSerializers": ["enzyme-to-json/serializer"]
7576
},
7677
"bugs": {
7778
"url": "https://github.com/open-source-labs/ReacType/issues"
@@ -83,8 +84,6 @@
8384
"@material-ui/core": "^4.11.0",
8485
"@material-ui/icons": "^4.0.1",
8586
"@material-ui/styles": "^4.9.6",
86-
"@types/enzyme": "^3.10.5",
87-
"@types/enzyme-adapter-react-16": "^1.0.6",
8887
"@types/js-cookie": "^2.2.6",
8988
"@types/node": "^14.0.20",
9089
"@types/prettier": "^1.19.0",
@@ -124,6 +123,8 @@
124123
"@babel/preset-react": "^7.10.4",
125124
"@babel/preset-typescript": "^7.10.4",
126125
"@types/chai": "^4.2.11",
126+
"@types/enzyme": "^3.10.5",
127+
"@types/enzyme-adapter-react-16": "^1.0.6",
127128
"@types/jest": "^25.1.5",
128129
"babel-eslint": "^8.2.6",
129130
"babel-jest": "^25.2.4",
@@ -136,6 +137,7 @@
136137
"dotenv": "^8.2.0",
137138
"electron": "^9.1.0",
138139
"electron-builder": "^22.7.0",
140+
"enzyme-to-json": "^3.5.0",
139141
"eslint": "^4.19.1",
140142
"eslint-config-airbnb-base": "^13.0.0",
141143
"eslint-plugin-babel": "^5.3.1",

0 commit comments

Comments
 (0)