Skip to content

Commit 59e757f

Browse files
committed
config jest to mock CSS Modules; update Cart snapshot
1 parent fdf9b8d commit 59e757f

File tree

4 files changed

+77
-20
lines changed

4 files changed

+77
-20
lines changed

jest.config.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
module.exports = {
22
"verbose": true,
33
"testURL": "http://localhost/",
4-
"setupFiles": ["./test/jest-setup-enzyme.js"]
4+
"setupFiles": ["./test/jest-setup-enzyme.js"],
5+
"moduleNameMapper": {
6+
"\\.(css)$": "identity-obj-proxy"
7+
}
58
}

package-lock.json

Lines changed: 15 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@
2929
"enzyme-adapter-react-16": "^1.2.0",
3030
"file-loader": "^1.1.11",
3131
"html-webpack-plugin": "^3.2.0",
32+
"identity-obj-proxy": "^3.0.0",
3233
"jest": "^23.4.2",
3334
"react-test-renderer": "^16.4.2",
3435
"style-loader": "^0.21.0",

src/components/__snapshots__/Cart.test.js.snap

Lines changed: 57 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,37 +1,59 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

33
exports[`UI and rendering matches snapshot 1`] = `
4-
<div>
5-
<h1>
4+
<div
5+
className="cart"
6+
>
7+
<h1
8+
className="headline"
9+
>
610
Your Cart
711
</h1>
8-
<table>
12+
<table
13+
className="table"
14+
>
915
<thead>
1016
<tr>
11-
<th>
17+
<th
18+
className="call"
19+
>
1220
Item
1321
</th>
14-
<th>
22+
<th
23+
className="call"
24+
>
1525
Price
1626
</th>
17-
<th>
27+
<th
28+
className="call"
29+
>
1830
Qty
1931
</th>
20-
<th />
32+
<th
33+
className="call"
34+
/>
2135
</tr>
2236
</thead>
2337
<tbody>
2438
<tr>
25-
<td>
39+
<td
40+
className="cell"
41+
>
2642
A
2743
</td>
28-
<td>
44+
<td
45+
className="cell"
46+
>
2947
$1.00
3048
</td>
31-
<td>
49+
<td
50+
className="cell"
51+
>
3252
1
3353
</td>
34-
<td>
54+
<td
55+
className="cell"
56+
>
3557
<button
3658
data-test-name="remove-item"
3759
onClick={[Function]}
@@ -41,16 +63,24 @@ exports[`UI and rendering matches snapshot 1`] = `
4163
</td>
4264
</tr>
4365
<tr>
44-
<td>
66+
<td
67+
className="cell"
68+
>
4569
B
4670
</td>
47-
<td>
71+
<td
72+
className="cell"
73+
>
4874
$1.50
4975
</td>
50-
<td>
76+
<td
77+
className="cell"
78+
>
5179
2
5280
</td>
53-
<td>
81+
<td
82+
className="cell"
83+
>
5484
<button
5585
data-test-name="remove-item"
5686
onClick={[Function]}
@@ -60,16 +90,24 @@ exports[`UI and rendering matches snapshot 1`] = `
6090
</td>
6191
</tr>
6292
<tr>
63-
<td>
93+
<td
94+
className="cell"
95+
>
6496
C
6597
</td>
66-
<td>
98+
<td
99+
className="cell"
100+
>
67101
$2.00
68102
</td>
69-
<td>
103+
<td
104+
className="cell"
105+
>
70106
3
71107
</td>
72-
<td>
108+
<td
109+
className="cell"
110+
>
73111
<button
74112
data-test-name="remove-item"
75113
onClick={[Function]}

0 commit comments

Comments
 (0)