@@ -26,7 +26,11 @@ describe('components/NotificationRow.tsx', () => {
26
26
hostname : 'github.com' ,
27
27
} ;
28
28
29
- const tree = render ( < NotificationRow { ...props } /> ) ;
29
+ const tree = render (
30
+ < AppContext . Provider value = { { settings : mockSettings } } >
31
+ < NotificationRow { ...props } />
32
+ </ AppContext . Provider > ,
33
+ ) ;
30
34
expect ( tree ) . toMatchSnapshot ( ) ;
31
35
} ) ;
32
36
@@ -43,7 +47,11 @@ describe('components/NotificationRow.tsx', () => {
43
47
hostname : 'github.com' ,
44
48
} ;
45
49
46
- const tree = render ( < NotificationRow { ...props } /> ) ;
50
+ const tree = render (
51
+ < AppContext . Provider value = { { settings : mockSettings } } >
52
+ < NotificationRow { ...props } />
53
+ </ AppContext . Provider > ,
54
+ ) ;
47
55
expect ( tree ) . toMatchSnapshot ( ) ;
48
56
} ) ;
49
57
@@ -60,11 +68,42 @@ describe('components/NotificationRow.tsx', () => {
60
68
hostname : 'github.com' ,
61
69
} ;
62
70
63
- const tree = render ( < NotificationRow { ...props } /> ) ;
71
+ const tree = render (
72
+ < AppContext . Provider value = { { settings : mockSettings } } >
73
+ < NotificationRow { ...props } />
74
+ </ AppContext . Provider > ,
75
+ ) ;
64
76
expect ( tree ) . toMatchSnapshot ( ) ;
65
77
} ) ;
66
78
67
79
describe ( 'notification pills / metrics' , ( ) => {
80
+ describe ( 'showPills disabled' , ( ) => {
81
+ it ( 'should not render any pills when showPills is disabled' , async ( ) => {
82
+ jest
83
+ . spyOn ( global . Date , 'now' )
84
+ . mockImplementation ( ( ) => new Date ( '2024' ) . valueOf ( ) ) ;
85
+
86
+ const mockNotification = mockSingleNotification ;
87
+ mockNotification . subject . linkedIssues = [ '#1' ] ;
88
+
89
+ const props = {
90
+ notification : mockNotification ,
91
+ hostname : 'github.com' ,
92
+ } ;
93
+
94
+ const tree = render (
95
+ < AppContext . Provider
96
+ value = { {
97
+ settings : { ...mockSettings , showPills : false } ,
98
+ } }
99
+ >
100
+ < NotificationRow { ...props } />
101
+ </ AppContext . Provider > ,
102
+ ) ;
103
+ expect ( tree ) . toMatchSnapshot ( ) ;
104
+ } ) ;
105
+ } ) ;
106
+
68
107
describe ( 'linked issue pills' , ( ) => {
69
108
it ( 'should render issues pill when linked to one issue/pr' , async ( ) => {
70
109
jest
@@ -79,7 +118,15 @@ describe('components/NotificationRow.tsx', () => {
79
118
hostname : 'github.com' ,
80
119
} ;
81
120
82
- const tree = render ( < NotificationRow { ...props } /> ) ;
121
+ const tree = render (
122
+ < AppContext . Provider
123
+ value = { {
124
+ settings : mockSettings ,
125
+ } }
126
+ >
127
+ < NotificationRow { ...props } />
128
+ </ AppContext . Provider > ,
129
+ ) ;
83
130
expect ( tree ) . toMatchSnapshot ( ) ;
84
131
} ) ;
85
132
@@ -96,7 +143,15 @@ describe('components/NotificationRow.tsx', () => {
96
143
hostname : 'github.com' ,
97
144
} ;
98
145
99
- const tree = render ( < NotificationRow { ...props } /> ) ;
146
+ const tree = render (
147
+ < AppContext . Provider
148
+ value = { {
149
+ settings : mockSettings ,
150
+ } }
151
+ >
152
+ < NotificationRow { ...props } />
153
+ </ AppContext . Provider > ,
154
+ ) ;
100
155
expect ( tree ) . toMatchSnapshot ( ) ;
101
156
} ) ;
102
157
} ) ;
@@ -115,7 +170,15 @@ describe('components/NotificationRow.tsx', () => {
115
170
hostname : 'github.com' ,
116
171
} ;
117
172
118
- const tree = render ( < NotificationRow { ...props } /> ) ;
173
+ const tree = render (
174
+ < AppContext . Provider
175
+ value = { {
176
+ settings : mockSettings ,
177
+ } }
178
+ >
179
+ < NotificationRow { ...props } />
180
+ </ AppContext . Provider > ,
181
+ ) ;
119
182
expect ( tree ) . toMatchSnapshot ( ) ;
120
183
} ) ;
121
184
@@ -132,7 +195,15 @@ describe('components/NotificationRow.tsx', () => {
132
195
hostname : 'github.com' ,
133
196
} ;
134
197
135
- const tree = render ( < NotificationRow { ...props } /> ) ;
198
+ const tree = render (
199
+ < AppContext . Provider
200
+ value = { {
201
+ settings : mockSettings ,
202
+ } }
203
+ >
204
+ < NotificationRow { ...props } />
205
+ </ AppContext . Provider > ,
206
+ ) ;
136
207
expect ( tree ) . toMatchSnapshot ( ) ;
137
208
} ) ;
138
209
@@ -149,7 +220,15 @@ describe('components/NotificationRow.tsx', () => {
149
220
hostname : 'github.com' ,
150
221
} ;
151
222
152
- const tree = render ( < NotificationRow { ...props } /> ) ;
223
+ const tree = render (
224
+ < AppContext . Provider
225
+ value = { {
226
+ settings : mockSettings ,
227
+ } }
228
+ >
229
+ < NotificationRow { ...props } />
230
+ </ AppContext . Provider > ,
231
+ ) ;
153
232
expect ( tree ) . toMatchSnapshot ( ) ;
154
233
} ) ;
155
234
} ) ;
@@ -168,7 +247,15 @@ describe('components/NotificationRow.tsx', () => {
168
247
hostname : 'github.com' ,
169
248
} ;
170
249
171
- const tree = render ( < NotificationRow { ...props } /> ) ;
250
+ const tree = render (
251
+ < AppContext . Provider
252
+ value = { {
253
+ settings : mockSettings ,
254
+ } }
255
+ >
256
+ < NotificationRow { ...props } />
257
+ </ AppContext . Provider > ,
258
+ ) ;
172
259
expect ( tree ) . toMatchSnapshot ( ) ;
173
260
} ) ;
174
261
} ) ;
@@ -190,7 +277,15 @@ describe('components/NotificationRow.tsx', () => {
190
277
hostname : 'github.com' ,
191
278
} ;
192
279
193
- const tree = render ( < NotificationRow { ...props } /> ) ;
280
+ const tree = render (
281
+ < AppContext . Provider
282
+ value = { {
283
+ settings : mockSettings ,
284
+ } }
285
+ >
286
+ < NotificationRow { ...props } />
287
+ </ AppContext . Provider > ,
288
+ ) ;
194
289
expect ( tree ) . toMatchSnapshot ( ) ;
195
290
} ) ;
196
291
@@ -210,7 +305,15 @@ describe('components/NotificationRow.tsx', () => {
210
305
hostname : 'github.com' ,
211
306
} ;
212
307
213
- const tree = render ( < NotificationRow { ...props } /> ) ;
308
+ const tree = render (
309
+ < AppContext . Provider
310
+ value = { {
311
+ settings : mockSettings ,
312
+ } }
313
+ >
314
+ < NotificationRow { ...props } />
315
+ </ AppContext . Provider > ,
316
+ ) ;
214
317
expect ( tree ) . toMatchSnapshot ( ) ;
215
318
} ) ;
216
319
} ) ;
@@ -304,12 +407,10 @@ describe('components/NotificationRow.tsx', () => {
304
407
< AppContext . Provider
305
408
value = { {
306
409
settings : { ...mockSettings , markAsDoneOnOpen : false } ,
307
- auth : mockAuth ,
410
+ markNotificationRead ,
308
411
} }
309
412
>
310
- < AppContext . Provider value = { { markNotificationRead } } >
311
- < NotificationRow { ...props } />
312
- </ AppContext . Provider >
413
+ < NotificationRow { ...props } />
313
414
</ AppContext . Provider > ,
314
415
) ;
315
416
@@ -327,14 +428,9 @@ describe('components/NotificationRow.tsx', () => {
327
428
328
429
render (
329
430
< AppContext . Provider
330
- value = { {
331
- settings : { ...mockSettings } ,
332
- auth : mockAuth ,
333
- } }
431
+ value = { { settings : mockSettings , markNotificationDone } }
334
432
>
335
- < AppContext . Provider value = { { markNotificationDone } } >
336
- < NotificationRow { ...props } />
337
- </ AppContext . Provider >
433
+ < NotificationRow { ...props } />
338
434
</ AppContext . Provider > ,
339
435
) ;
340
436
@@ -352,7 +448,9 @@ describe('components/NotificationRow.tsx', () => {
352
448
353
449
render (
354
450
< AppContext . Provider value = { { } } >
355
- < AppContext . Provider value = { { unsubscribeNotification } } >
451
+ < AppContext . Provider
452
+ value = { { settings : mockSettings , unsubscribeNotification } }
453
+ >
356
454
< NotificationRow { ...props } />
357
455
</ AppContext . Provider >
358
456
</ AppContext . Provider > ,
0 commit comments