Skip to content

Commit 62b0083

Browse files
committed
Apply linting fixes
Signed-off-by: Olga Bulat <obulat@gmail.com>
1 parent cb4d6e7 commit 62b0083

File tree

5 files changed

+931
-932
lines changed

5 files changed

+931
-932
lines changed

tests/e2e/specs/AttributionDetailsStep.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
module.exports = {
22
'@tags': ['att'],
3-
'AttributionDetailsStep'(browser){
3+
'AttributionDetailsStep'(browser) {
44
const knowLicenseSelector = '.b-radio'
55
const nextButton = '.pagination-next'
66
const select = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > div > div > span > select'
77
const selectOpt = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > div > div > span > select > option:nth-child(4)'
88
const stepTitle = '.step-title'
99
const attributionDetailsInstructions = '.attribution-details-instructions'
10-
const workAuthorLabel ='#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > form > div:nth-child(1) > label'
10+
const workAuthorLabel = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > form > div:nth-child(1) > label'
1111
const workAuthorInput = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > form > div:nth-child(1) > div > input'
1212
const urlCreatorProfileLabel = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > form > div:nth-child(2) > label'
1313
const urlCreatorProfileInput = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > form > div:nth-child(2) > div > input'
@@ -18,12 +18,11 @@ module.exports = {
1818
const backBtn = '.pagination-previous'
1919
const paginationFinish = '.pagination-finish'
2020

21-
2221
browser
2322
.init()
2423
.click(knowLicenseSelector)
2524
.click(nextButton)
26-
.click(select, () =>{
25+
.click(select, () => {
2726
browser.click(selectOpt)
2827
})
2928
.click(nextButton)
@@ -40,4 +39,4 @@ module.exports = {
4039
.assert.visible(backBtn, 'Back button is visible')
4140
.assert.visible(paginationFinish, 'Pagination Finish Block is visible')
4241
}
43-
}
42+
}

tests/unit/FirstStep.spec.js

Lines changed: 0 additions & 79 deletions
This file was deleted.

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

Lines changed: 39 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import Vuex from 'vuex'
44
import AttributionDetailsStep from '@/components/AttributionDetailsStep'
55

66
const localVue = createLocalVue()
7-
7+
88
localVue.use(Vuex)
99
localVue.use(Buefy)
1010

@@ -27,40 +27,40 @@ describe('AttributionDetailsStep Component Rendering', () => {
2727
}
2828
}
2929
}
30-
30+
3131
})
3232
})
3333

34-
afterEach(()=> {
34+
afterEach(() => {
3535
wrapper.destroy()
3636
})
3737

38-
it('Component not mounted if status is previous', () =>{
39-
wrapper.setProps({status : 'previous'})
38+
it('Component not mounted if status is previous', () => {
39+
wrapper.setProps({ status: 'previous' })
4040
expect(wrapper.find('.step-actions').exists()).toBeFalsy()
4141
})
4242

43-
it('Component not mounted if status is inactive', () =>{
44-
wrapper.setProps({status : 'inactive'})
43+
it('Component not mounted if status is inactive', () => {
44+
wrapper.setProps({ status: 'inactive' })
4545
expect(wrapper.find('.step-actions').exists()).toBeFalsy()
4646
})
4747

48-
it('Component mounted if status is current', () =>{
49-
wrapper.setProps({status : 'current'})
48+
it('Component mounted if status is current', () => {
49+
wrapper.setProps({ status: 'current' })
5050
expect(wrapper.element).toMatchSnapshot()
5151
})
5252
})
5353

5454
describe('Store is updated when a user provides input', () => {
55-
let mutations, state, wrapper,store
55+
let mutations, state, wrapper, store
5656

5757
beforeEach(() => {
5858
mutations = {
5959
setCreatorName: jest.fn(),
6060
setCreatorProfileUrl: jest.fn(),
6161
setWorkTitle: jest.fn(),
6262
setWorkUrl: jest.fn()
63-
};
63+
}
6464

6565
state = {
6666
attributionDetails: {
@@ -69,54 +69,53 @@ describe('Store is updated when a user provides input', () => {
6969
workTitle: '',
7070
workUrl: ''
7171
}
72-
};
72+
}
7373

7474
store = new Vuex.Store({
7575
state,
76-
mutations,
77-
});
76+
mutations
77+
})
7878

7979
wrapper = mount(AttributionDetailsStep, {
8080
propsData: {
8181
status: 'current'
8282
},
8383
mocks: {
8484
$t: key => key
85-
},
85+
},
8686
store,
87-
localVue,
88-
});
87+
localVue
88+
})
8989
})
9090

91-
afterEach(()=> {
91+
afterEach(() => {
9292
wrapper.destroy()
9393
})
9494

9595
it('Creator Name is updated', async() => {
96-
const input = wrapper.find('input[placeholder="stepper.AD.form.creator-name.placeholder"]')
97-
await input.setValue("Jane Bar")
98-
expect(mutations.setCreatorName).toHaveBeenCalled()
99-
})
100-
101-
//CreatorProfile URL
96+
const input = wrapper.find('input[placeholder="stepper.AD.form.creator-name.placeholder"]')
97+
await input.setValue('Jane Bar')
98+
expect(mutations.setCreatorName).toHaveBeenCalled()
99+
})
100+
101+
// CreatorProfile URL
102102
it('Profile Url is updated', async() => {
103-
const input = wrapper.find('input[placeholder="stepper.AD.form.creator-profile.placeholder"]')
104-
await input.setValue("jane@bar.com")
105-
expect(mutations.setCreatorProfileUrl).toHaveBeenCalled()
106-
})
103+
const input = wrapper.find('input[placeholder="stepper.AD.form.creator-profile.placeholder"]')
104+
await input.setValue('jane@bar.com')
105+
expect(mutations.setCreatorProfileUrl).toHaveBeenCalled()
106+
})
107107

108-
//Work URL
108+
// Work URL
109109
it('Work Url is updated', async() => {
110-
const input = wrapper.find('input[placeholder="stepper.AD.form.work-url.placeholder"]')
111-
await input.setValue("jane@bar.com/kitty.jpeg")
112-
expect(mutations.setWorkUrl).toHaveBeenCalled()
113-
})
110+
const input = wrapper.find('input[placeholder="stepper.AD.form.work-url.placeholder"]')
111+
await input.setValue('jane@bar.com/kitty.jpeg')
112+
expect(mutations.setWorkUrl).toHaveBeenCalled()
113+
})
114114

115-
//Work Title
115+
// Work Title
116116
it('Work Title is updated', async() => {
117-
const input = wrapper.find('input[placeholder="stepper.AD.form.work-title.placeholder"]')
118-
await input.setValue("illustrator")
119-
expect(mutations.setWorkTitle).toHaveBeenCalled()
120-
})
121-
122-
})
117+
const input = wrapper.find('input[placeholder="stepper.AD.form.work-title.placeholder"]')
118+
await input.setValue('illustrator')
119+
expect(mutations.setWorkTitle).toHaveBeenCalled()
120+
})
121+
})
Lines changed: 79 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,79 @@
1+
import { mount } from '@vue/test-utils'
2+
import FirstStep from '@/components/FirstStep.vue'
3+
4+
describe('FirstStep.vue', () => {
5+
const wrapper = mount(FirstStep)
6+
it('Has the main div tag', () => {
7+
expect(wrapper.contains('.step-content')).toBe(true)
8+
})
9+
10+
it('renders without any errors', () => {
11+
expect(wrapper.isVueInstance()).toBeTruthy()
12+
})
13+
14+
it('Checks if the cardtext function return the correct answer when selected is true', () => {
15+
wrapper.setProps({
16+
selected: true
17+
})
18+
19+
expect(wrapper.vm.cardText).toBe('stepper.FS.selected')
20+
})
21+
22+
it('Checks if the cardtext function return the correct answer when selected is false', () => {
23+
wrapper.setProps({
24+
selected: false
25+
})
26+
27+
expect(wrapper.vm.cardText).toBe('stepper.FS.not-selected')
28+
})
29+
30+
it('Checks if the yesText function returns correct answer ', () => {
31+
expect(wrapper.vm.yesText).toBe('stepper.FS.selected')
32+
})
33+
34+
it('Checks if the noText function returns correct answer', () => {
35+
expect(wrapper.vm.noText).toBe('stepper.FS.not-selected')
36+
})
37+
38+
it('Checks if the yesSelected function returns the correct boolean when selected is true', () => {
39+
wrapper.setProps({
40+
selected: true
41+
})
42+
expect(wrapper.vm.yesSelected).toBe('selected')
43+
})
44+
45+
it('Checks if the yesSelected function returns the correct boolean when selected is false', () => {
46+
wrapper.setProps({
47+
selected: false
48+
})
49+
expect(wrapper.vm.yesSelected).toBe('not-selected')
50+
})
51+
52+
it('Checks if the get function in radio returns the correct value when selected is undefined', () => {
53+
wrapper.setProps({
54+
selected: undefined
55+
})
56+
expect(wrapper.vm.radio).toBe(undefined)
57+
})
58+
59+
it('Checks if the get function in radio returns the correct value when selected is yes', () => {
60+
wrapper.setData({
61+
selected: 'yes'
62+
})
63+
expect(wrapper.vm.radio).toBe('yes')
64+
})
65+
66+
it('Checks if the noSelected function returns the correct boolean when selected is true', () => {
67+
wrapper.setProps({
68+
selected: true
69+
})
70+
expect(wrapper.vm.noSelected).toBe('not-selected')
71+
})
72+
73+
it('Checks if the noSelected function returns the correct boolean when selected is false', () => {
74+
wrapper.setProps({
75+
selected: false
76+
})
77+
expect(wrapper.vm.noSelected).toBe('selected')
78+
})
79+
})

0 commit comments

Comments
 (0)