You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/testing/jest.md
+77-77Lines changed: 77 additions & 77 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -71,25 +71,25 @@ Add `package.json`:
71
71
72
72
* For a file `foo.ts`:
73
73
74
-
```js
75
-
exportconstsum
76
-
= (...a:number[]) =>
77
-
a.reduce((acc, val) => acc + val, 0);
78
-
```
74
+
```js
75
+
exportconstsum
76
+
= (...a:number[]) =>
77
+
a.reduce((acc, val) => acc + val, 0);
78
+
```
79
79
80
80
*A simple `foo.test.ts`:
81
81
82
-
```js
83
-
import { sum } from'../foo';
82
+
```js
83
+
import { sum } from '../foo';
84
84
85
-
test('basic', () => {
86
-
expect(sum()).toBe(0);
87
-
});
85
+
test('basic', () => {
86
+
expect(sum()).toBe(0);
87
+
});
88
88
89
-
test('basic again', () => {
90
-
expect(sum(1, 2)).toBe(3);
91
-
});
92
-
```
89
+
test('basic again', () => {
90
+
expect(sum(1, 2)).toBe(3);
91
+
});
92
+
```
93
93
94
94
Notes:
95
95
@@ -119,81 +119,81 @@ Enzyme allows you to test react components with dom support. There are three ste
119
119
1. Install enzyme, types for enzyme, a better snapshot serializer for enzyme, enzyme-adapter-react for your react version `npm i enzyme @types/enzyme enzyme-to-json enzyme-adapter-react-16 -D`
120
120
2. Add `"snapshotSerializers"` and `"setupTestFrameworkScriptFile"` to your `jest.config.js`:
0 commit comments