Skip to content

Commit 52a0845

Browse files
committed
Tweaks tests and snapshots around new functionality
1 parent aea21d0 commit 52a0845

File tree

7 files changed

+55
-5
lines changed

7 files changed

+55
-5
lines changed

src/tests/components/ActivityDashboard.test.tsx

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ test('Should render ActivityDashboard correctly with editMode equals to false',
1616
createActivity={() => { }}
1717
editActivity={() => { }}
1818
deleteActivity={() => { }}
19+
submitting={false}
20+
target=''
1921
/>
2022
)
2123

@@ -34,6 +36,8 @@ test('Should render ActivityDashboard correctly with editMode equals to true', (
3436
createActivity={() => { }}
3537
editActivity={() => { }}
3638
deleteActivity={() => { }}
39+
submitting={false}
40+
target=''
3741
/>
3842
)
3943

@@ -52,6 +56,8 @@ test('Should render ActivityDashboard correctly with edit mode false and selecte
5256
createActivity={() => { }}
5357
editActivity={() => { }}
5458
deleteActivity={() => { }}
59+
submitting={false}
60+
target=''
5561
/>
5662
)
5763

src/tests/components/ActivityForm.test.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ test('Should render ActivityForm correctly when activity prop is null', () => {
1212
activity={null}
1313
createActivity={() => { }}
1414
editActivity={() => { }}
15+
submitting={false}
1516
/>
1617
)
1718

@@ -25,6 +26,7 @@ test('Should render ActivityForm correctly with given activity', () => {
2526
activity={fakeActivities[0]}
2627
createActivity={() => { }}
2728
editActivity={() => { }}
29+
submitting={false}
2830
/>
2931
)
3032

@@ -40,6 +42,7 @@ test('Should call setEditMode with false when Cancel button is clicked ', () =>
4042
activity={fakeActivities[0]}
4143
createActivity={() => { }}
4244
editActivity={() => { }}
45+
submitting={false}
4346
/>
4447
)
4548

src/tests/components/ActivityList.test.tsx

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,10 @@ test('Should render ActivityList correctly', () => {
1010
activities={fakeActivities}
1111
selectActivity={() => { }}
1212
deleteActivity={() => { }}
13-
/>)
13+
submitting={false}
14+
target=''
15+
/>
16+
)
1417

1518
expect(wrapper).toMatchSnapshot()
1619
})
@@ -23,7 +26,11 @@ test('Should call selectActivity once when button is clicked', () => {
2326
activities={fakeActivities}
2427
selectActivity={selectActivitySpy}
2528
deleteActivity={() => { }}
26-
/>)
29+
submitting={false}
30+
target=''
31+
/>
32+
)
33+
2734
wrapper.find('Button').first().simulate('click')
2835
expect(selectActivitySpy).toHaveBeenCalledTimes(1)
2936
})
@@ -35,8 +42,11 @@ test('Should call deleteActivity once when delete button is clicked', () => {
3542
activities={fakeActivities}
3643
selectActivity={() => { }}
3744
deleteActivity={deleteActivitySpy}
38-
/>)
45+
submitting={false}
46+
target=''
47+
/>
48+
)
3949

40-
wrapper.find('Button').at(1).simulate('click')
41-
expect(deleteActivitySpy).toHaveBeenCalledTimes(1)
50+
wrapper.find('Button').at(1).simulate('click')
51+
expect(deleteActivitySpy).toHaveBeenCalledTimes(1)
4252
})

src/tests/components/__snapshots__/ActivityDashboard.test.tsx.snap

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,8 @@ exports[`Should render ActivityDashboard correctly with edit mode false and sele
3030
}
3131
deleteActivity={[Function]}
3232
selectActivity={[Function]}
33+
submitting={false}
34+
target=""
3335
/>
3436
</GridColumn>
3537
<GridColumn
@@ -68,6 +70,8 @@ exports[`Should render ActivityDashboard correctly with editMode equals to false
6870
}
6971
deleteActivity={[Function]}
7072
selectActivity={[Function]}
73+
submitting={false}
74+
target=""
7175
/>
7276
</GridColumn>
7377
<GridColumn
@@ -122,6 +126,8 @@ exports[`Should render ActivityDashboard correctly with editMode equals to true
122126
}
123127
deleteActivity={[Function]}
124128
selectActivity={[Function]}
129+
submitting={false}
130+
target=""
125131
/>
126132
</GridColumn>
127133
<GridColumn
@@ -143,6 +149,7 @@ exports[`Should render ActivityDashboard correctly with editMode equals to true
143149
editActivity={[Function]}
144150
key="1"
145151
setEditMode={[Function]}
152+
submitting={false}
146153
/>
147154
</GridColumn>
148155
</Grid>

src/tests/components/__snapshots__/ActivityForm.test.tsx.snap

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -62,6 +62,7 @@ exports[`Should render ActivityForm correctly when activity prop is null 1`] = `
6262
as="button"
6363
content="Submit"
6464
floated="right"
65+
loading={false}
6566
positive={true}
6667
type="submit"
6768
/>
@@ -138,6 +139,7 @@ exports[`Should render ActivityForm correctly with given activity 1`] = `
138139
as="button"
139140
content="Submit"
140141
floated="right"
142+
loading={false}
141143
positive={true}
142144
type="submit"
143145
/>

src/tests/components/__snapshots__/ActivityList.test.tsx.snap

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,8 @@ exports[`Should render ActivityList correctly 1`] = `
4242
color="red"
4343
content="Delete"
4444
floated="right"
45+
loading={false}
46+
name="1"
4547
onClick={[Function]}
4648
/>
4749
<Label
@@ -86,6 +88,8 @@ exports[`Should render ActivityList correctly 1`] = `
8688
color="red"
8789
content="Delete"
8890
floated="right"
91+
loading={false}
92+
name="2"
8993
onClick={[Function]}
9094
/>
9195
<Label

src/tests/components/__snapshots__/App.test.tsx.snap

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,8 @@ exports[`Should render App correctly when activities are fetched successfully 1`
140140
selectedActivity={null}
141141
setEditMode={[Function]}
142142
setSelectedActivity={[Function]}
143+
submitting={false}
144+
target=""
143145
>
144146
<Grid>
145147
<div
@@ -176,6 +178,8 @@ exports[`Should render App correctly when activities are fetched successfully 1`
176178
}
177179
deleteActivity={[Function]}
178180
selectActivity={[Function]}
181+
submitting={false}
182+
target=""
179183
>
180184
<Segment
181185
clearing={true}
@@ -276,13 +280,16 @@ exports[`Should render App correctly when activities are fetched successfully 1`
276280
color="red"
277281
content="Delete"
278282
floated="right"
283+
loading={false}
284+
name="1"
279285
onClick={[Function]}
280286
>
281287
<Ref
282288
innerRef={
283289
Object {
284290
"current": <button
285291
class="ui red right floated button"
292+
name="1"
286293
>
287294
Delete
288295
</button>,
@@ -294,6 +301,7 @@ exports[`Should render App correctly when activities are fetched successfully 1`
294301
Object {
295302
"current": <button
296303
class="ui red right floated button"
304+
name="1"
297305
>
298306
Delete
299307
</button>,
@@ -302,6 +310,7 @@ exports[`Should render App correctly when activities are fetched successfully 1`
302310
>
303311
<button
304312
className="ui red right floated button"
313+
name="1"
305314
onClick={[Function]}
306315
>
307316
Delete
@@ -413,13 +422,16 @@ exports[`Should render App correctly when activities are fetched successfully 1`
413422
color="red"
414423
content="Delete"
415424
floated="right"
425+
loading={false}
426+
name="2"
416427
onClick={[Function]}
417428
>
418429
<Ref
419430
innerRef={
420431
Object {
421432
"current": <button
422433
class="ui red right floated button"
434+
name="2"
423435
>
424436
Delete
425437
</button>,
@@ -431,6 +443,7 @@ exports[`Should render App correctly when activities are fetched successfully 1`
431443
Object {
432444
"current": <button
433445
class="ui red right floated button"
446+
name="2"
434447
>
435448
Delete
436449
</button>,
@@ -439,6 +452,7 @@ exports[`Should render App correctly when activities are fetched successfully 1`
439452
>
440453
<button
441454
className="ui red right floated button"
455+
name="2"
442456
onClick={[Function]}
443457
>
444458
Delete
@@ -604,6 +618,8 @@ exports[`Should render App correctly with empty activity list 1`] = `
604618
selectedActivity={null}
605619
setEditMode={[Function]}
606620
setSelectedActivity={[Function]}
621+
submitting={false}
622+
target=""
607623
>
608624
<Grid>
609625
<div
@@ -619,6 +635,8 @@ exports[`Should render App correctly with empty activity list 1`] = `
619635
activities={Array []}
620636
deleteActivity={[Function]}
621637
selectActivity={[Function]}
638+
submitting={false}
639+
target=""
622640
>
623641
<Segment
624642
clearing={true}

0 commit comments

Comments
 (0)