Skip to content

Commit 97804f4

Browse files
committed
Update unit tests
- Adds tests to test rendering of AttributionDetailsComponent @ different statuses - Modifies unit test to test condition status is current - Modifies snapshot
1 parent 2a636ee commit 97804f4

File tree

2 files changed

+31
-157
lines changed

2 files changed

+31
-157
lines changed

tests/unit/specs/components/AttributionDetailsStep.spec.js

+30-18
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,39 @@ const localVue = createLocalVue()
88
localVue.use(Vuex)
99
localVue.use(Buefy)
1010

11-
it('AttributionDetailsStep Component is mounted if status is current', () => {
12-
const wrapper = mount(AttributionDetailsStep, {
13-
localVue,
14-
propsData: {
15-
status: 'current'
16-
17-
},
18-
mocks: {
19-
$t: key => key,
20-
$store: {
21-
state: {
22-
attributionDetails: {
23-
creatorName: '',
24-
creatorProfileUrl: '',
25-
workTitle: '',
26-
workUrl: ''
11+
describe('AttributionDetailsStep Component Rendering', () => {
12+
13+
const wrapper = mount(AttributionDetailsStep, {
14+
localVue,
15+
mocks: {
16+
$t: key => key,
17+
$store: {
18+
state: {
19+
attributionDetails: {
20+
creatorName: '',
21+
creatorProfileUrl: '',
22+
workTitle: '',
23+
workUrl: ''
24+
}
2725
}
2826
}
2927
}
30-
}
28+
29+
})
30+
31+
it('Component not mounted if status is previous', () =>{
32+
wrapper.setProps({status : 'previous'})
33+
expect(wrapper.find('.step-action').exists()).toBeFalsy
34+
})
3135

36+
it('Component not mounted if status is inactive', () =>{
37+
wrapper.setProps({status : 'inactive'})
38+
expect(wrapper.find('.step-action').exists()).toBeFalsy
39+
})
40+
41+
it('Component mounted if status is current', () =>{
42+
wrapper.setProps({status : 'current'})
43+
expect(wrapper.element).toMatchSnapshot()
3244
})
33-
expect(wrapper.element).toMatchSnapshot()
3445
})
46+

tests/unit/specs/components/__snapshots__/AttributionDetailsStep.spec.js.snap

+1-139
Original file line numberDiff line numberDiff line change
@@ -1,144 +1,6 @@
11
// Jest Snapshot v1, https://goo.gl/fbAQLP
22

3-
exports[`AttributeDetailsStep Component is mounted if status is current 1`] = `
4-
<div
5-
class="step-content"
6-
>
7-
<div
8-
class="step-actions"
9-
>
10-
<p
11-
class="attribution-details-instructions"
12-
>
13-
14-
stepper.AD.instructions
15-
16-
</p>
17-
18-
<form
19-
class="attribution-details-form"
20-
>
21-
<div
22-
class="field"
23-
>
24-
<label
25-
class="label"
26-
>
27-
stepper.AD.form.creator-name.label
28-
</label>
29-
30-
<div
31-
class="control is-clearfix"
32-
>
33-
<input
34-
autocomplete="on"
35-
class="input"
36-
placeholder="stepper.AD.form.creator-name.placeholder"
37-
type="text"
38-
/>
39-
40-
<!---->
41-
42-
<!---->
43-
44-
<!---->
45-
</div>
46-
47-
<!---->
48-
</div>
49-
50-
<div
51-
class="field"
52-
>
53-
<label
54-
class="label"
55-
>
56-
stepper.AD.form.creator-profile.label
57-
</label>
58-
59-
<div
60-
class="control is-clearfix"
61-
>
62-
<input
63-
autocomplete="on"
64-
class="input"
65-
placeholder="stepper.AD.form.creator-profile.placeholder"
66-
type="text"
67-
/>
68-
69-
<!---->
70-
71-
<!---->
72-
73-
<!---->
74-
</div>
75-
76-
<!---->
77-
</div>
78-
79-
<div
80-
class="field"
81-
>
82-
<label
83-
class="label"
84-
>
85-
stepper.AD.form.work-title.label
86-
</label>
87-
88-
<div
89-
class="control is-clearfix"
90-
>
91-
<input
92-
autocomplete="on"
93-
class="input"
94-
placeholder="stepper.AD.form.work-title.placeholder"
95-
type="text"
96-
/>
97-
98-
<!---->
99-
100-
<!---->
101-
102-
<!---->
103-
</div>
104-
105-
<!---->
106-
</div>
107-
108-
<div
109-
class="field"
110-
>
111-
<label
112-
class="label"
113-
>
114-
stepper.AD.form.work-url.label
115-
</label>
116-
117-
<div
118-
class="control is-clearfix"
119-
>
120-
<input
121-
autocomplete="on"
122-
class="input"
123-
placeholder="stepper.AD.form.work-url.placeholder"
124-
type="text"
125-
/>
126-
127-
<!---->
128-
129-
<!---->
130-
131-
<!---->
132-
</div>
133-
134-
<!---->
135-
</div>
136-
</form>
137-
</div>
138-
</div>
139-
`;
140-
141-
exports[`AttributionDetailsStep Component is mounted if status is current 1`] = `
3+
exports[`AttributionDetailsStep Component Rendering Component mounted if status is current 1`] = `
1424
<div
1435
class="step-content"
1446
>

0 commit comments

Comments
 (0)