Skip to content

Commit

Permalink
Apply linting fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Olga Bulat <obulat@gmail.com>
  • Loading branch information
obulat committed Apr 3, 2020
1 parent cb4d6e7 commit 62b0083
Show file tree
Hide file tree
Showing 5 changed files with 931 additions and 932 deletions.
9 changes: 4 additions & 5 deletions tests/e2e/specs/AttributionDetailsStep.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
module.exports = {
'@tags': ['att'],
'AttributionDetailsStep'(browser){
'AttributionDetailsStep'(browser) {
const knowLicenseSelector = '.b-radio'
const nextButton = '.pagination-next'
const select = '#site-container > div.columns > div.stepper-container.column > div.step-container.current.enabled > div.step-content > div > div > div > span > select'
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)'
const stepTitle = '.step-title'
const attributionDetailsInstructions = '.attribution-details-instructions'
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'
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'
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'
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'
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'
Expand All @@ -18,12 +18,11 @@ module.exports = {
const backBtn = '.pagination-previous'
const paginationFinish = '.pagination-finish'


browser
.init()
.click(knowLicenseSelector)
.click(nextButton)
.click(select, () =>{
.click(select, () => {
browser.click(selectOpt)
})
.click(nextButton)
Expand All @@ -40,4 +39,4 @@ module.exports = {
.assert.visible(backBtn, 'Back button is visible')
.assert.visible(paginationFinish, 'Pagination Finish Block is visible')
}
}
}
79 changes: 0 additions & 79 deletions tests/unit/FirstStep.spec.js

This file was deleted.

79 changes: 39 additions & 40 deletions tests/unit/specs/components/AttributionDetailsStep.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import Vuex from 'vuex'
import AttributionDetailsStep from '@/components/AttributionDetailsStep'

const localVue = createLocalVue()

localVue.use(Vuex)
localVue.use(Buefy)

Expand All @@ -27,40 +27,40 @@ describe('AttributionDetailsStep Component Rendering', () => {
}
}
}

})
})

afterEach(()=> {
afterEach(() => {
wrapper.destroy()
})

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

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

it('Component mounted if status is current', () =>{
wrapper.setProps({status : 'current'})
it('Component mounted if status is current', () => {
wrapper.setProps({ status: 'current' })
expect(wrapper.element).toMatchSnapshot()
})
})

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

beforeEach(() => {
mutations = {
setCreatorName: jest.fn(),
setCreatorProfileUrl: jest.fn(),
setWorkTitle: jest.fn(),
setWorkUrl: jest.fn()
};
}

state = {
attributionDetails: {
Expand All @@ -69,54 +69,53 @@ describe('Store is updated when a user provides input', () => {
workTitle: '',
workUrl: ''
}
};
}

store = new Vuex.Store({
state,
mutations,
});
mutations
})

wrapper = mount(AttributionDetailsStep, {
propsData: {
status: 'current'
},
mocks: {
$t: key => key
},
},
store,
localVue,
});
localVue
})
})

afterEach(()=> {
afterEach(() => {
wrapper.destroy()
})

it('Creator Name is updated', async() => {
const input = wrapper.find('input[placeholder="stepper.AD.form.creator-name.placeholder"]')
await input.setValue("Jane Bar")
expect(mutations.setCreatorName).toHaveBeenCalled()
})
//CreatorProfile URL
const input = wrapper.find('input[placeholder="stepper.AD.form.creator-name.placeholder"]')
await input.setValue('Jane Bar')
expect(mutations.setCreatorName).toHaveBeenCalled()
})

// CreatorProfile URL
it('Profile Url is updated', async() => {
const input = wrapper.find('input[placeholder="stepper.AD.form.creator-profile.placeholder"]')
await input.setValue("jane@bar.com")
expect(mutations.setCreatorProfileUrl).toHaveBeenCalled()
})
const input = wrapper.find('input[placeholder="stepper.AD.form.creator-profile.placeholder"]')
await input.setValue('jane@bar.com')
expect(mutations.setCreatorProfileUrl).toHaveBeenCalled()
})

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

//Work Title
// Work Title
it('Work Title is updated', async() => {
const input = wrapper.find('input[placeholder="stepper.AD.form.work-title.placeholder"]')
await input.setValue("illustrator")
expect(mutations.setWorkTitle).toHaveBeenCalled()
})

})
const input = wrapper.find('input[placeholder="stepper.AD.form.work-title.placeholder"]')
await input.setValue('illustrator')
expect(mutations.setWorkTitle).toHaveBeenCalled()
})
})
79 changes: 79 additions & 0 deletions tests/unit/specs/components/FirstStep.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
import { mount } from '@vue/test-utils'
import FirstStep from '@/components/FirstStep.vue'

describe('FirstStep.vue', () => {
const wrapper = mount(FirstStep)
it('Has the main div tag', () => {
expect(wrapper.contains('.step-content')).toBe(true)
})

it('renders without any errors', () => {
expect(wrapper.isVueInstance()).toBeTruthy()
})

it('Checks if the cardtext function return the correct answer when selected is true', () => {
wrapper.setProps({
selected: true
})

expect(wrapper.vm.cardText).toBe('stepper.FS.selected')
})

it('Checks if the cardtext function return the correct answer when selected is false', () => {
wrapper.setProps({
selected: false
})

expect(wrapper.vm.cardText).toBe('stepper.FS.not-selected')
})

it('Checks if the yesText function returns correct answer ', () => {
expect(wrapper.vm.yesText).toBe('stepper.FS.selected')
})

it('Checks if the noText function returns correct answer', () => {
expect(wrapper.vm.noText).toBe('stepper.FS.not-selected')
})

it('Checks if the yesSelected function returns the correct boolean when selected is true', () => {
wrapper.setProps({
selected: true
})
expect(wrapper.vm.yesSelected).toBe('selected')
})

it('Checks if the yesSelected function returns the correct boolean when selected is false', () => {
wrapper.setProps({
selected: false
})
expect(wrapper.vm.yesSelected).toBe('not-selected')
})

it('Checks if the get function in radio returns the correct value when selected is undefined', () => {
wrapper.setProps({
selected: undefined
})
expect(wrapper.vm.radio).toBe(undefined)
})

it('Checks if the get function in radio returns the correct value when selected is yes', () => {
wrapper.setData({
selected: 'yes'
})
expect(wrapper.vm.radio).toBe('yes')
})

it('Checks if the noSelected function returns the correct boolean when selected is true', () => {
wrapper.setProps({
selected: true
})
expect(wrapper.vm.noSelected).toBe('not-selected')
})

it('Checks if the noSelected function returns the correct boolean when selected is false', () => {
wrapper.setProps({
selected: false
})
expect(wrapper.vm.noSelected).toBe('selected')
})
})
Loading

0 comments on commit 62b0083

Please sign in to comment.