Use vue-test-helpers

This commit is contained in:
Phan An 2018-01-21 00:27:56 +01:00
parent 395fd8cb27
commit 8e9b021aa0
40 changed files with 726 additions and 244 deletions

View file

@ -54,6 +54,7 @@
"youtube-player": "^3.0.4"
},
"devDependencies": {
"@vue/test-utils": "^1.0.0-beta.10",
"autoprefixer": "^6.7.2",
"babel-core": "^6.26.0",
"babel-eslint": "^7.2.3",
@ -87,7 +88,7 @@
"sinon-test": "^2.1.2",
"vue-loader": "^13.0.5",
"vue-template-compiler": "^2.5.0",
"vue-test-utils": "^1.0.0-beta.7",
"vue-test-helpers": "^1.0.9",
"webpack": "^3.6.0",
"webpack-node-externals": "^1.6.0"
},

View file

@ -9,7 +9,7 @@ describe('components/auth/login-form', () => {
it('triggers login when form is submitted', () => {
const wrapper = shallow(LoginForm)
const loginStub = sinon.stub(userStore, 'login')
wrapper.find('form').trigger('submit')
wrapper.submit('form')
loginStub.calledWith(wrapper.vm.email, wrapper.vm.password).should.be.true
loginStub.restore()
})

View file

@ -29,7 +29,7 @@ describe('components/main-wrapper/extra/album-info', () => {
const wrapper = shallow(AlbumInfo, {
propsData: { album }
})
wrapper.find('.wiki button.more').trigger('click')
wrapper.click('.wiki button.more')
wrapper.html().should.contain(album.info.wiki.full)
})

View file

@ -28,7 +28,7 @@ describe('components/main-wrapper/extra/artist-info', () => {
const wrapper = shallow(ArtistInfo, {
propsData: { artist }
})
wrapper.find('.bio button.more').trigger('click')
wrapper.click('.bio button.more')
wrapper.html().should.contain(artist.info.bio.full)
})

View file

@ -19,14 +19,14 @@ describe('components/main-wrapper/extra/index', () => {
sharedState: { useYouTube: true }
})
wrapper.findAll('.header .youtube').should.have.lengthOf(1)
wrapper.contains(YouTube).should.be.true
wrapper.has(YouTube).should.be.true
})
it('switches pane properly', () => {
const wrapper = shallow(ExtraSidebar)
expect(wrapper.find('.header .active').is('.lyrics')).toBe(true)
;['.artist', '.album', '.lyrics'].forEach(selector => {
wrapper.find(`.header ${selector}`).trigger('click')
wrapper.click(`.header ${selector}`)
wrapper.find('.header .active').is(selector).should.be.true
})
})
@ -39,7 +39,7 @@ describe('components/main-wrapper/extra/index', () => {
}
})
;[ArtistInfo, AlbumInfo, Lyrics, YouTube].forEach(component => {
wrapper.contains(component).should.be.true
wrapper.has(component).should.be.true
})
})

View file

@ -21,7 +21,7 @@ describe('components/main-wrapper/extra/youtube', () => {
it('loads more videos on demand', () => {
const stub = sinon.stub(youtubeService, 'searchVideosRelatedToSong')
wrapper.find('button.more').trigger('click')
wrapper.click('button.more')
stub.calledWith(song).should.be.true
stub.restore()
})

View file

@ -5,9 +5,6 @@ import Extra from '@/components/main-wrapper/extra/index.vue'
describe('component/main-wrapper/index', () => {
it('renders properly', () => {
const wrapper = mount(Component)
wrapper.contains(Sidebar).should.be.true
wrapper.contains(MainContent).should.be.true
wrapper.contains(Extra).should.be.true
mount(Component).hasAll(Sidebar, MainContent, Extra).should.be.true
})
})

View file

@ -14,8 +14,7 @@ describe('components/main-wrapper/main-content/album', () => {
const html = wrapper.html()
html.should.contain(album.name)
html.should.contain(album.artist.name)
wrapper.contains(SongList).should.be.true
wrapper.contains(SongListControls).should.be.true
wrapper.hasAll(SongList, SongListControls).should.be.true
})
})
@ -28,7 +27,7 @@ describe('components/main-wrapper/main-content/album', () => {
}
})
const stub = sinon.stub(albumInfoService, 'fetch')
wrapper.find('a.info').trigger('click')
wrapper.click('a.info')
stub.calledWith(album).should.be.true
stub.restore()
})
@ -42,7 +41,7 @@ describe('components/main-wrapper/main-content/album', () => {
}
})
const downloadStub = sinon.stub(download, 'fromAlbum')
wrapper.find('a.download').trigger('click')
wrapper.click('a.download')
downloadStub.calledWith(album).should.be.true
downloadStub.restore()
})

View file

@ -30,8 +30,7 @@ describe('components/main-wrapper/main-content/artist', () => {
const html = wrapper.html()
html.should.contain(artist.name)
html.should.contain('1 album')
wrapper.contains(SongList).should.be.true
wrapper.contains(SongListControls).should.be.true
wrapper.hasAll(SongList, SongListControls).should.be.true
})
})
@ -42,7 +41,7 @@ describe('components/main-wrapper/main-content/artist', () => {
sharedState: { useLastfm: true }
}})
const stub = sinon.stub(artistInfoService, 'fetch')
wrapper.find('a.info').trigger('click')
wrapper.click('a.info')
stub.calledWith(artist).should.be.true
stub.restore()
})
@ -53,7 +52,7 @@ describe('components/main-wrapper/main-content/artist', () => {
sharedState: { allowDownload: true }
}})
const downloadStub = sinon.stub(download, 'fromArtist')
wrapper.find('a.download').trigger('click')
wrapper.click('a.download')
downloadStub.calledWith(artist).should.be.true
downloadStub.restore()
})

View file

@ -11,8 +11,7 @@ describe('components/main-wrapper/main-content/favorites', () => {
songs: factory('song', 5)
}
}})
wrapper.contains(SongList).should.be.true
wrapper.contains(SongListControls).should.be.true
wrapper.hasAll(SongList, SongListControls).should.be.true
wrapper.findAll('div.none').should.have.lengthOf(0)
})
@ -31,7 +30,7 @@ describe('components/main-wrapper/main-content/favorites', () => {
songs: factory('song', 5)
},
sharedState: { allowDownload: true }
}}).find('a.download').trigger('click')
}}).click('a.download')
downloadStub.called.should.be.true
downloadStub.restore()
})

View file

@ -9,7 +9,7 @@ describe('components/main-wrapper/main-content/playlist', () => {
const playlist = factory('playlist', { populated: true })
const wrapper = shallow(Component, { data: { playlist }})
wrapper.find('h1.heading').html().should.contain(playlist.name)
wrapper.contains(SongList).should.be.true
wrapper.has(SongList).should.be.true
})
it('fetch and populate playlist content on demand', () => {
@ -27,7 +27,7 @@ describe('components/main-wrapper/main-content/playlist', () => {
populated: true,
songs: []
})
}}).contains('div.none').should.be.true
}}).has('div.none').should.be.true
})
it('confirms deleting if the playlist is not empty', () => {
@ -38,7 +38,7 @@ describe('components/main-wrapper/main-content/playlist', () => {
})
wrapper.setData({ playlist })
const confirmStub = sinon.stub(alerts, 'confirm')
wrapper.find('.btn-delete-playlist').trigger('click')
wrapper.click('.btn-delete-playlist')
confirmStub.calledWith('Are you sure? This is a one-way street!', wrapper.vm.del).should.be.true
confirmStub.restore()
})
@ -52,7 +52,7 @@ describe('components/main-wrapper/main-content/playlist', () => {
wrapper.setData({ playlist })
const confirmStub = sinon.stub(alerts, 'confirm')
const deleteStub = sinon.stub(playlistStore, 'delete')
wrapper.find('.btn-delete-playlist').trigger('click')
wrapper.click('.btn-delete-playlist')
confirmStub.called.should.be.false
deleteStub.calledWith(playlist).should.be.true
confirmStub.restore()

View file

@ -8,7 +8,7 @@ describe('components/main-wrapper/main-content/user', () => {
})
it('displays a form to update profile', () => {
shallow(Profile).contains('form').should.be.true
shallow(Profile).has('form').should.be.true
})
it('validates password confirmation', () => {
@ -17,12 +17,12 @@ describe('components/main-wrapper/main-content/user', () => {
confirmPwd: 'bar'
}})
const updateProfileStub = sinon.stub(userStore, 'updateProfile')
wrapper.find('form').trigger('submit')
wrapper.submit('form')
updateProfileStub.called.should.be.false
wrapper.setData({
confirmPwd: 'foo'
})
wrapper.find('form').trigger('submit')
wrapper.submit('form')
updateProfileStub.called.should.be.true
updateProfileStub.restore()
})
@ -30,7 +30,7 @@ describe('components/main-wrapper/main-content/user', () => {
it('updates profile with password fields left empty', () => {
const wrapper = shallow(Profile)
const updateProfileStub = sinon.stub(userStore, 'updateProfile')
wrapper.find('form').trigger('submit')
wrapper.submit('form')
updateProfileStub.called.should.be.true
updateProfileStub.restore()
})
@ -40,7 +40,7 @@ describe('components/main-wrapper/main-content/user', () => {
const savePrefsStub = sinon.spy(preferenceStore, 'save')
wrapper.setData({ prefs: preferenceStore.state })
;['notify', 'confirmClosing', 'transcodeOnMobile'].forEach(key => {
wrapper.find(`input[name=${key}]`).trigger('click')
wrapper.submit(`input[name=${key}]`)
savePrefsStub.called.should.be.true
})
savePrefsStub.restore()

View file

@ -10,7 +10,7 @@ describe('components/main-wrapper/main-content/queue', () => {
state: { songs: factory('song', 10) }
}})
wrapper.find('h1.heading').text().should.contain('Current Queue')
wrapper.contains(SongList).should.be.true
wrapper.has(SongList).should.be.true
})
it('prompts to shuffle all songs if there are songs and current queue is empty', () => {
@ -26,7 +26,7 @@ describe('components/main-wrapper/main-content/queue', () => {
state: {
songs: []
}
}}).contains('a.start').should.be.false
}}).has('a.start').should.be.false
})
it('shuffles all songs in the queue if any', () => {
@ -34,7 +34,7 @@ describe('components/main-wrapper/main-content/queue', () => {
const songs = factory('song', 10)
mount(Component, { data: {
state: { songs }
}}).find('button.btn-shuffle-all').trigger('click')
}}).click('button.btn-shuffle-all')
stub.calledWith(songs).should.be.true
stub.restore()
})
@ -46,7 +46,7 @@ describe('components/main-wrapper/main-content/queue', () => {
state: {
songs: []
}
}}).find('button.btn-shuffle-all').trigger('click')
}}).click('button.btn-shuffle-all')
stub.calledWith(songStore.all).should.be.true
stub.restore()
})
@ -57,7 +57,7 @@ describe('components/main-wrapper/main-content/queue', () => {
wrapper.setData({
state: { songs: factory('song', 10) }
})
wrapper.find('button.btn-clear-queue').trigger('click')
wrapper.click('button.btn-clear-queue')
stub.called.should.be.true
stub.restore()
})

View file

@ -18,7 +18,7 @@ describe('components/main-wrapper/main-content/settings', () => {
it('warns if changing a non-empty media path', () => {
sharedStore.state.originalMediaPath = '/bar'
const stub = sinon.stub(alerts, 'confirm')
shallow(Component).find('form').trigger('submit')
shallow(Component).submit('form')
stub.called.should.be.true
stub.restore()
})
@ -27,7 +27,7 @@ describe('components/main-wrapper/main-content/settings', () => {
sharedStore.state.originalMediaPath = ''
const confirmStub = sinon.stub(alerts, 'confirm')
const updateStub = sinon.stub(settingStore, 'update')
shallow(Component).find('form').trigger('submit')
shallow(Component).submit('form')
confirmStub.called.should.be.false
updateStub.called.should.be.true
confirmStub.restore()

View file

@ -8,6 +8,6 @@ describe('components/main-wrapper/main-content/settings', () => {
songStore.all = factory('song', 10)
const wrapper = shallow(Component)
wrapper.find('h1.heading').text().should.contain('All Songs')
wrapper.contains(SongList).should.be.true
wrapper.has(SongList).should.be.true
})
})

View file

@ -15,8 +15,8 @@ describe('components/main-wrapper/main-content/users', () => {
userStore.all = factory('user', 10)
const wrapper = mount(Component)
const openStub = sinon.stub(wrapper.vm.$refs.addUserForm, 'open')
wrapper.contains(AddUserForm).should.be.true
wrapper.find('.btn-add').trigger('click')
wrapper.has(AddUserForm).should.be.true
wrapper.click('.btn-add')
openStub.called.should.be.true
openStub.restore()
})
@ -25,8 +25,8 @@ describe('components/main-wrapper/main-content/users', () => {
userStore.all = factory('user', 10)
const wrapper = mount(Component)
const editStub = sinon.stub(wrapper.vm.$refs.editUserForm, 'open')
wrapper.contains(EditUserForm).should.be.true
wrapper.findAll('.btn-edit').at(0).trigger('click')
wrapper.has(EditUserForm).should.be.true
wrapper.click('.btn-edit')
editStub.calledWith(userStore.all[0]).should.be.true
editStub.restore()
})

View file

@ -5,16 +5,15 @@ import factory from '@/tests/factory'
describe('compoponents/main-wrapper/sidebar/index', () => {
it('renders properly', () => {
const wrapper = shallow(Component)
;['home', 'queue', 'songs', 'albums', 'artists'].forEach(item => {
wrapper.contains(`.menu a.${item}`).should.be.true
})
wrapper.contains(Playlists).should.be.true
shallow(Component).hasAll(
Playlists,
...(['home', 'queue', 'songs', 'albums', 'artists'].map(item => `.menu a.${item}`))
).should.be.true
})
it('displays YouTube menu item if using YouTube', () => {
sharedStore.state.useYouTube = true
shallow(Component).contains('a.youtube').should.be.true
shallow(Component).has('a.youtube').should.be.true
})
it('displays management menu items for admin', () => {
@ -23,9 +22,7 @@ describe('compoponents/main-wrapper/sidebar/index', () => {
current: factory('user', { is_admin: true })
}
}})
;['settings', 'users'].forEach(item => {
wrapper.contains(`.menu a.${item}`).should.be.true
})
wrapper.hasAll('.menu a.settings', '.menu a.users').should.be.true
})
it('displays new version info', () => {
@ -36,7 +33,7 @@ describe('compoponents/main-wrapper/sidebar/index', () => {
current: factory('user', { is_admin: true })
}
}})
wrapper.contains('a.new-ver').should.be.true
wrapper.has('a.new-ver').should.be.true
wrapper.find('a.new-ver').text().should.contain('Koel version v0.0.1 is available!')
})
})

View file

@ -33,8 +33,8 @@ describe('component/main-wrapper/sidebar/playlist-item', () => {
const wrapper = shallow(Component, {
propsData: { playlist }
})
wrapper.find('li.playlist').trigger('dblclick')
wrapper.find('input[type=text]').trigger('blur')
wrapper.dblclick('li.playlist')
wrapper.blur('input[type=text]')
updateStub.calledWith(playlist).should.be.true
})
@ -45,7 +45,7 @@ describe('component/main-wrapper/sidebar/playlist-item', () => {
type: 'favorites'
}
})
wrapper.find('li.favorites').trigger('dblclick')
wrapper.contains('input[type=text]').should.be.false
wrapper.dblclick('li.favorites')
wrapper.has('input[type=text]').should.be.false
})
})

View file

@ -11,8 +11,4 @@ describe('compopents/main-wrapper/main-content/sidebar/playlist', () => {
}})
wrapper.findAll(PlaylistItem).should.have.lengthOf(6) // favorites + 5 playlists
})
it('adds a new playlist', () => {
const wrapper = mount(Component)
})
})

View file

@ -6,7 +6,7 @@ describe('components/modals/add-user-form', () => {
it('opens', async done => {
const wrapper = shallow(Component)
await wrapper.vm.open()
wrapper.contains('form.user-add').should.be.true
wrapper.has('form.user-add').should.be.true
done()
})
@ -16,7 +16,7 @@ describe('components/modals/add-user-form', () => {
const wrapper = shallow(Component)
await wrapper.vm.open()
wrapper.setData({ newUser })
wrapper.find('form.user-add').trigger('submit')
wrapper.submit('form.user-add')
storeStub.calledWith(newUser.name, newUser.email, newUser.password).should.be.true
storeStub.restore()
done()
@ -25,9 +25,9 @@ describe('components/modals/add-user-form', () => {
it('cancels', async done => {
const wrapper = shallow(Component)
await wrapper.vm.open()
wrapper.contains('form.user-add').should.be.true
wrapper.has('form.user-add').should.be.true
await wrapper.vm.cancel()
wrapper.contains('form.user-add').should.be.false
wrapper.has('form.user-add').should.be.false
done()
})
})

View file

@ -18,7 +18,7 @@ describe('components/modals/edit-songs-form', () => {
it('opens', async done => {
const wrapper = shallow(Component)
await wrapper.vm.open(factory('song', 3))
wrapper.contains('form').should.be.true
wrapper.has('form').should.be.true
done()
})
@ -32,13 +32,13 @@ describe('components/modals/edit-songs-form', () => {
metaHtml.should.contain(song.album.name)
metaHtml.should.contain(song.artist.name)
wrapper.find('input[name=title]').element.value.should.equal(song.title)
wrapper.find('input[name=album]').element.value.should.equal(song.album.name)
wrapper.find('input[name=artist]').element.value.should.equal(song.artist.name)
wrapper.find('input[name=track]').element.value.should.equal(song.track.toString())
wrapper.find('input[name=title]').value.should.equal(song.title)
wrapper.find('input[name=album]').value.should.equal(song.album.name)
wrapper.find('input[name=artist]').value.should.equal(song.artist.name)
wrapper.find('input[name=track]').value.should.equal(song.track.toString())
wrapper.find('.tabs .tab-lyrics').trigger('click')
wrapper.find('textarea[name=lyrics]').element.value.should.equal(song.lyrics)
wrapper.click('.tabs .tab-lyrics')
wrapper.find('textarea[name=lyrics]').value.should.equal(song.lyrics)
done()
})
@ -52,9 +52,9 @@ describe('components/modals/edit-songs-form', () => {
metaHtml.should.contain('Mixed Artists')
metaHtml.should.contain('Mixed Albums')
wrapper.find('input[name=artist]').element.value.should.be.empty
wrapper.find('input[name=album]').element.value.should.be.empty
wrapper.contains('.tabs .tab-lyrics').should.be.false
wrapper.find('input[name=artist]').value.should.be.empty
wrapper.find('input[name=album]').value.should.be.empty
wrapper.has('.tabs .tab-lyrics').should.be.false
done()
})
@ -73,9 +73,9 @@ describe('components/modals/edit-songs-form', () => {
metaHtml.should.contain(artist.name)
metaHtml.should.contain('Mixed Albums')
wrapper.find('input[name=artist]').element.value.should.equal(artist.name)
wrapper.find('input[name=album]').element.value.should.be.empty
wrapper.contains('.tabs .tab-lyrics').should.be.false
wrapper.find('input[name=artist]').value.should.equal(artist.name)
wrapper.find('input[name=album]').value.should.be.empty
wrapper.has('.tabs .tab-lyrics').should.be.false
done()
})
@ -96,9 +96,9 @@ describe('components/modals/edit-songs-form', () => {
metaHtml.should.contain(album.name)
metaHtml.should.contain(album.artist.name)
wrapper.find('input[name=artist]').element.value.should.equal(album.artist.name)
wrapper.find('input[name=album]').element.value.should.equal(album.name)
wrapper.contains('.tabs .tab-lyrics').should.be.false
wrapper.find('input[name=artist]').value.should.equal(album.artist.name)
wrapper.find('input[name=album]').value.should.equal(album.name)
wrapper.has('.tabs .tab-lyrics').should.be.false
done()
})
@ -110,7 +110,7 @@ describe('components/modals/edit-songs-form', () => {
const formData = { foo: 'bar' }
await wrapper.vm.open(songs)
wrapper.setData({ formData })
wrapper.find('form').trigger('submit')
wrapper.submit('form')
updateStub.calledWith(songs, formData).should.be.true
done()
@ -120,7 +120,7 @@ describe('components/modals/edit-songs-form', () => {
const wrapper = shallow(Component)
await wrapper.vm.open(factory('song', 3))
await wrapper.vm.close()
wrapper.contains('form').should.be.false
wrapper.has('form').should.be.false
done()
})
})

View file

@ -7,10 +7,9 @@ describe('components/modals/edit-user-form', () => {
const user = factory('user')
const wrapper = shallow(Component)
await wrapper.vm.open(user)
wrapper.contains('form.user-edit').should.be.true
wrapper.find('input[name=name]').element.value.should.equal(user.name)
wrapper.find('input[name=email]').element.value.should.equal(user.email)
wrapper.has('form.user-edit').should.be.true
wrapper.find('input[name=name]').value.should.equal(user.name)
wrapper.find('input[name=email]').value.should.equal(user.email)
done()
})
@ -19,10 +18,9 @@ describe('components/modals/edit-user-form', () => {
const updateStub = sinon.stub(userStore, 'update')
const wrapper = shallow(Component)
await wrapper.vm.open(user)
wrapper.find('form').trigger('submit')
wrapper.submit('form')
updateStub.calledWith(user, user.name, user.email, user.password).should.be.true
updateStub.restore()
done()
})
@ -31,12 +29,11 @@ describe('components/modals/edit-user-form', () => {
const updateStub = sinon.stub(userStore, 'update')
const wrapper = shallow(Component)
await wrapper.vm.open(user)
wrapper.contains('form.user-edit').should.be.true
wrapper.find('.btn-cancel').trigger('click')
wrapper.contains('form.user-edit').should.be.false
wrapper.has('form.user-edit').should.be.true
wrapper.click('.btn-cancel')
wrapper.has('form.user-edit').should.be.false
updateStub.called.should.be.false
updateStub.restore()
done()
})
})

View file

@ -25,39 +25,33 @@ describe('components/shared/add-to-menu', () => {
playlistStore.all = factory('playlist', 10)
const wrapper = initComponent()
wrapper.html().should.contain('Add 5 songs to')
wrapper.contains('li.after-current').should.be.true
wrapper.contains('li.bottom-queue').should.be.true
wrapper.contains('li.top-queue').should.be.true
wrapper.contains('li.favorites').should.be.true
wrapper.hasAll('li.after-current', 'li.bottom-queue', 'li.top-queue', 'li.favorites', 'form.form-new-playlist').should.be.true
wrapper.findAll('li.playlist').should.have.lengthOf(10)
wrapper.contains('form.form-new-playlist').should.be.true
})
it('supports different configurations', () => {
// add to queue
let wrapper = initComponent({ queue: false })
wrapper.contains('li.after-current').should.be.false
wrapper.contains('li.bottom-queue').should.be.false
wrapper.contains('li.top-queue').should.be.false
wrapper.hasNone('li.after-current', 'li.bottom-queue', 'li.top-queue').should.be.true
// add to favorites
wrapper = initComponent({ favorites: false })
wrapper.contains('li.favorites').should.be.false
wrapper.has('li.favorites').should.be.false
// add to playlists
wrapper = initComponent({ playlists: false })
wrapper.contains('li.playlist').should.be.false
wrapper.has('li.playlist').should.be.false
// add to a new playlist
wrapper = initComponent({ newPlaylist: false })
wrapper.contains('form.form-new-playlist').should.be.false
wrapper.has('form.form-new-playlist').should.be.false
})
it('queue songs after current', () => {
const wrapper = initComponent()
const queueStub = sinon.stub(queueStore, 'queueAfterCurrent')
const closeStub = sinon.stub(wrapper.vm, 'close')
wrapper.find('li.after-current').trigger('click')
wrapper.click('li.after-current')
queueStub.calledWith(songs).should.be.true
closeStub.called.should.be.true
queueStub.restore()
@ -68,7 +62,7 @@ describe('components/shared/add-to-menu', () => {
const wrapper = initComponent()
const queueStub = sinon.stub(queueStore, 'queue')
const closeStub = sinon.stub(wrapper.vm, 'close')
wrapper.find('li.bottom-queue').trigger('click')
wrapper.click('li.bottom-queue')
queueStub.calledWith(songs).should.be.true
closeStub.called.should.be.true
queueStub.restore()
@ -79,7 +73,7 @@ describe('components/shared/add-to-menu', () => {
const wrapper = initComponent()
const queueStub = sinon.stub(queueStore, 'queue')
const closeStub = sinon.stub(wrapper.vm, 'close')
wrapper.find('li.top-queue').trigger('click')
wrapper.click('li.top-queue')
queueStub.calledWith(songs, false, true).should.be.true
closeStub.called.should.be.true
queueStub.restore()
@ -90,7 +84,7 @@ describe('components/shared/add-to-menu', () => {
const wrapper = initComponent()
const likeStub = sinon.stub(favoriteStore, 'like')
const closeStub = sinon.stub(wrapper.vm, 'close')
wrapper.find('li.favorites').trigger('click')
wrapper.click('li.favorites')
likeStub.calledWith(songs).should.be.true
closeStub.called.should.be.true
likeStub.restore()
@ -103,7 +97,7 @@ describe('components/shared/add-to-menu', () => {
const wrapper = initComponent()
const addSongsStub = sinon.stub(playlistStore, 'addSongs')
const closeStub = sinon.stub(wrapper.vm, 'close')
wrapper.findAll('li.playlist').at(1).trigger('click')
wrapper.findAll('li.playlist').at(1).click()
addSongsStub.calledWith(playlists[1], songs).should.be.true
closeStub.called.should.be.true
addSongsStub.restore()
@ -119,7 +113,7 @@ describe('components/shared/add-to-menu', () => {
const wrapper = initComponent()
const closeStub = sinon.stub(wrapper.vm, 'close')
wrapper.setData({ newPlaylistName: 'Foo' })
await wrapper.find('form.form-new-playlist').trigger('submit')
await wrapper.submit('form.form-new-playlist')
storeStub.calledWith('Foo', songs).should.be.true
closeStub.restore()
done()

View file

@ -14,7 +14,7 @@ describe('components/shared/album-item', () => {
it('renders properly', () => {
const wrapper = shallow(Component, { propsData: { album }})
wrapper.contains('span.cover').should.be.true
wrapper.has('span.cover').should.be.true
const html = wrapper.html()
html.should.contain(album.name)
html.should.contain('10 songs')
@ -22,7 +22,7 @@ describe('components/shared/album-item', () => {
it('plays if clicked', () => {
const playStub = sinon.stub(playback, 'playAllInAlbum')
shallow(Component, { propsData: { album }}).find('.control-play').trigger('click')
shallow(Component, { propsData: { album }}).click('.control-play')
playStub.calledWith(album, false).should.be.true
playStub.restore()
})
@ -30,16 +30,16 @@ describe('components/shared/album-item', () => {
it('queues if ctrl/meta clicked', () => {
const queueStub = sinon.stub(queueStore, 'queue')
const wrapper = shallow(Component, { propsData: { album }})
wrapper.find('.control-play').trigger('click', { metaKey: true })
wrapper.click('.control-play', { metaKey: true })
queueStub.called.should.be.true
wrapper.find('.control-play').trigger('click', { ctrlKey: true })
wrapper.click('.control-play', { ctrlKey: true })
queueStub.called.should.be.true
queueStub.restore()
})
it('shuffles', () => {
const playStub = sinon.stub(playback, 'playAllInAlbum')
shallow(Component, { propsData: { album }}).find('.shuffle-album').trigger('click')
shallow(Component, { propsData: { album }}).click('.shuffle-album')
playStub.calledWith(album, true).should.be.true
playStub.restore()
})
@ -47,7 +47,7 @@ describe('components/shared/album-item', () => {
it('downloads', () => {
sharedStore.state = { allowDownload: true }
const downloadStub = sinon.stub(download, 'fromAlbum')
shallow(Component, { propsData: { album }}).find('.download-album').trigger('click')
shallow(Component, { propsData: { album }}).click('.download-album')
downloadStub.calledWith(album).should.be.true
downloadStub.restore()
})

View file

@ -16,7 +16,7 @@ describe('components/shared/artist-item', () => {
it('renders properly', () => {
const wrapper = shallow(Component, { propsData: { artist }})
wrapper.contains('span.cover').should.be.true
wrapper.has('span.cover').should.be.true
const html = wrapper.html()
html.should.contain('4 albums')
html.should.contain('16 songs')
@ -25,7 +25,7 @@ describe('components/shared/artist-item', () => {
it('plays if clicked', () => {
const playStub = sinon.stub(playback, 'playAllByArtist')
shallow(Component, { propsData: { artist }}).find('.control-play').trigger('click')
shallow(Component, { propsData: { artist }}).click('.control-play')
playStub.calledWith(artist, false).should.be.true
playStub.restore()
})
@ -33,16 +33,16 @@ describe('components/shared/artist-item', () => {
it('queues if ctrl/meta clicked', () => {
const queueStub = sinon.stub(queueStore, 'queue')
const wrapper = shallow(Component, { propsData: { artist }})
wrapper.find('.control-play').trigger('click', { metaKey: true })
wrapper.click('.control-play', { metaKey: true })
queueStub.called.should.be.true
wrapper.find('.control-play').trigger('click', { ctrlKey: true })
wrapper.click('.control-play', { ctrlKey: true })
queueStub.called.should.be.true
queueStub.restore()
})
it('shuffles', () => {
const playStub = sinon.stub(playback, 'playAllByArtist')
shallow(Component, { propsData: { artist }}).find('.shuffle-artist').trigger('click')
shallow(Component, { propsData: { artist }}).click('.shuffle-artist')
playStub.calledWith(artist, true).should.be.true
playStub.restore()
})
@ -50,7 +50,7 @@ describe('components/shared/artist-item', () => {
it('downloads', () => {
sharedStore.state = { allowDownload: true }
const downloadStub = sinon.stub(download, 'fromArtist')
shallow(Component, { propsData: { artist }}).find('.download-artist').trigger('click')
shallow(Component, { propsData: { artist }}).click('.download-artist')
downloadStub.calledWith(artist).should.be.true
downloadStub.restore()
})

View file

@ -19,17 +19,16 @@ describe('components/shared/home-song-item', () => {
it('renders properly', () => {
const wrapper = shallow(Component, { propsData })
wrapper.contains('span.cover').should.be.true
wrapper.contains('span.details').should.be.true
wrapper.hasAll('span.cover', 'span.details').should.be.true
wrapper.html().should.contain('Foo Fighter')
wrapper.html().should.contains('10 plays')
wrapper.html().should.contain('10 plays')
})
it('queues and plays if not queued', () => {
const containsStub = sinon.stub(queueStore, 'contains').callsFake(() => false)
const queueStub = sinon.stub(queueStore, 'queueAfterCurrent')
const playStub = sinon.stub(playback, 'play')
shallow(Component, { propsData }).find('.song-item-home').trigger('dblclick')
shallow(Component, { propsData }).dblclick('.song-item-home')
containsStub.calledWith(song).should.be.true
queueStub.calledWith(song).should.be.true
playStub.calledWith(song).should.be.true
@ -43,7 +42,7 @@ describe('components/shared/home-song-item', () => {
const containsStub = sinon.stub(queueStore, 'contains').callsFake(() => true)
const queueStub = sinon.stub(queueStore, 'queueAfterCurrent')
const playStub = sinon.stub(playback, 'play')
shallow(Component, { propsData }).find('.song-item-home').trigger('dblclick')
shallow(Component, { propsData }).dblclick('.song-item-home')
containsStub.calledWith(song).should.be.true
queueStub.called.should.be.false
playStub.calledWith(song).should.be.true
@ -59,13 +58,13 @@ describe('components/shared/home-song-item', () => {
const resumeStub = sinon.stub(playback, 'resume')
const pauseStub = sinon.stub(playback, 'pause')
wrapper.find('.cover .control').trigger('click')
wrapper.click('.cover .control')
playStub.called.should.be.true
song.playbackState = 'paused'
wrapper.find('.cover .control').trigger('click')
wrapper.click('.cover .control')
resumeStub.called.should.be.true
song.playbackState = 'playing'
wrapper.find('.cover .control').trigger('click')
wrapper.click('.cover .control')
pauseStub.called.should.be.true
playStub.restore()

View file

@ -5,8 +5,8 @@ describe('components/shared/overlay', () => {
it('shows with default options', async done => {
const wrapper = mount(Component)
await wrapper.vm.show()
wrapper.contains(SoundBar).should.be.true
wrapper.contains('button.btn-dismiss').should.be.false
wrapper.has(SoundBar).should.be.true
wrapper.has('button.btn-dismiss').should.be.false
done()
})
@ -17,8 +17,8 @@ describe('components/shared/overlay', () => {
type: 'warning',
message: 'Foo'
})
wrapper.contains(SoundBar).should.be.false
wrapper.contains('button.btn-dismiss').should.be.true
wrapper.has(SoundBar).should.be.false
wrapper.has('button.btn-dismiss').should.be.true
wrapper.find('span.message').html().should.contain('Foo')
done()
})
@ -26,18 +26,18 @@ describe('components/shared/overlay', () => {
it('hides', async done => {
const wrapper = mount(Component)
await wrapper.vm.show()
wrapper.contains('.display').should.be.true
wrapper.has('.display').should.be.true
await wrapper.vm.hide()
wrapper.contains('.display').should.be.false
wrapper.has('.display').should.be.false
done()
})
it('dismisses', async done => {
const wrapper = mount(Component)
await wrapper.vm.show({ dismissable: true })
wrapper.contains('.display').should.be.true
wrapper.find('button.btn-dismiss').trigger('click')
wrapper.contains('.display').should.be.false
wrapper.has('.display').should.be.true
wrapper.click('button.btn-dismiss')
wrapper.has('.display').should.be.false
done()
})
})

View file

@ -38,7 +38,7 @@ describe('components/shared/song-item', () => {
const queueStub = sinon.stub(queueStore, 'queueAfterCurrent')
const playStub = sinon.stub(playback, 'play')
const wrapper = shallow(Component, { propsData: { item }})
wrapper.find('tr').trigger('dblclick')
wrapper.dblclick('tr')
containsStub.calledWith(song).should.be.true
queueStub.calledWith(song).should.be.true
playStub.calledWith(song).should.be.true
@ -53,7 +53,7 @@ describe('components/shared/song-item', () => {
const queueStub = sinon.stub(queueStore, 'queueAfterCurrent')
const playStub = sinon.stub(playback, 'play')
const wrapper = shallow(Component, { propsData: { item }})
wrapper.find('tr').trigger('dblclick')
wrapper.dblclick('tr')
containsStub.calledWith(song).should.be.true
queueStub.calledWith(song).should.be.false
playStub.calledWith(song).should.be.true
@ -69,15 +69,15 @@ describe('components/shared/song-item', () => {
const pauseStub = sinon.stub(playback, 'pause')
const playControl = shallow(Component, { propsData: { item }}).find('.play')
playControl.trigger('click')
playControl.click()
playStub.called.should.be.true
song.playbackState = 'playing'
playControl.trigger('click')
playControl.click()
pauseStub.called.should.be.true
song.playbackState = 'paused'
playControl.trigger('click')
playControl.click()
resumeStub.called.should.be.true
playStub.restore()

View file

@ -9,16 +9,16 @@ describe('components/shared/song-list-controls-toggler', () => {
it('renders properly', () => {
shallow(Component, { propsData: {
showingControls: true
}}).contains('.toggler.fa-angle-up').should.be.true
}}).has('.toggler.fa-angle-up').should.be.true
shallow(Component, { propsData: {
showingControls: false
}}).contains('.toggler.fa-angle-up').should.be.false
}}).has('.toggler.fa-angle-up').should.be.false
})
it('emits event', () => {
const wrapper = shallow(Component)
wrapper.find('.song-list-controls-toggler').trigger('click')
wrapper.emitted().toggleControls.should.be.ok
wrapper.click('.song-list-controls-toggler')
wrapper.hasEmitted('toggleControls').should.be.true
})
})

View file

@ -3,54 +3,44 @@ import factory from '@/tests/factory'
describe('components/shared/song-list-controls', () => {
it('allows shuffling all if less than 2 songs are selected', () => {
let wrapper = shallow(Component, { propsData: {
shallow(Component, { propsData: {
selectedSongs: []
}})
wrapper.find('.btn-shuffle-all').trigger('click')
wrapper.emitted().shuffleAll.should.be.ok
}}).click('.btn-shuffle-all').hasEmitted('shuffleAll').should.be.true
wrapper = shallow(Component, { propsData: {
shallow(Component, { propsData: {
selectedSongs: [factory('song')]
}})
wrapper.find('.btn-shuffle-all').trigger('click')
wrapper.emitted().shuffleAll.should.be.ok
}}).click('.btn-shuffle-all').hasEmitted('shuffleAll').should.be.true
})
it('allows shuffling selected if more than 1 song are selected', () => {
const wrapper = shallow(Component, { propsData: {
shallow(Component, { propsData: {
selectedSongs: factory('song', 3)
}})
wrapper.find('.btn-shuffle-selected').trigger('click')
wrapper.emitted().shuffleSelected.should.be.ok
}}).click('.btn-shuffle-selected').hasEmitted('shuffleSelected').should.be.true
})
it('displays the "Add To" menu', () => {
shallow(Component, { propsData: {
selectedSongs: factory('song', 3)
}}).contains('.btn-add-to').should.be.true
}}).has('.btn-add-to').should.be.true
})
it('allows clearing queue', () => {
const wrapper = shallow(Component, {
shallow(Component, {
data: {
fullConfig: {
clearQueue: true
}
}
})
wrapper.find('.btn-clear-queue').trigger('click')
wrapper.emitted().clearQueue.should.be.ok
}).click('.btn-clear-queue').hasEmitted('clearQueue').should.be.true
})
it('allows deleting current playlist', () => {
const wrapper = shallow(Component, {
shallow(Component, {
data: {
fullConfig: {
deletePlaylist: true
}
}
})
wrapper.find('.btn-delete-playlist').trigger('click')
wrapper.emitted().deletePlaylist.should.be.ok
}).click('.btn-delete-playlist').hasEmitted('deletePlaylist').should.be.true
})
})

View file

@ -51,7 +51,7 @@ describe('components/shared/song-list', () => {
'.time': 'song.length'
}
for (let selector in provider) {
wrapper.find(`.song-list-header ${selector}`).trigger('click')
wrapper.click(`.song-list-header ${selector}`)
sortStub.calledWith(provider[selector]).should.be.true
}
})
@ -63,42 +63,42 @@ describe('components/shared/song-list', () => {
}})
// track number
wrapper.find('.song-list-header .track-number').trigger('click')
wrapper.click('.song-list-header .track-number')
for (let i = 1, j = wrapper.vm.songRows.length; i < j; ++i) {
(wrapper.vm.songRows[i].song.track >= wrapper.vm.songRows[i - 1].song.track).should.be.true
}
// second sort should be descending
wrapper.find('.song-list-header .track-number').trigger('click')
wrapper.click('.song-list-header .track-number')
for (let i = 1, j = wrapper.vm.songRows.length; i < j; ++i) {
(wrapper.vm.songRows[i].song.track <= wrapper.vm.songRows[i - 1].song.track).should.be.true
}
// track number
wrapper.find('.song-list-header .title').trigger('click')
// title
wrapper.click('.song-list-header .title')
for (let i = 1, j = wrapper.vm.songRows.length; i < j; ++i) {
(wrapper.vm.songRows[i].song.title >= wrapper.vm.songRows[i - 1].song.title).should.be.true
}
wrapper.find('.song-list-header .title').trigger('click')
wrapper.click('.song-list-header .title')
for (let i = 1, j = wrapper.vm.songRows.length; i < j; ++i) {
(wrapper.vm.songRows[i].song.title <= wrapper.vm.songRows[i - 1].song.title).should.be.true
}
// artist
wrapper.find('.song-list-header .artist').trigger('click')
wrapper.click('.song-list-header .artist')
for (let i = 1, j = wrapper.vm.songRows.length; i < j; ++i) {
(wrapper.vm.songRows[i].song.album.artist.name >= wrapper.vm.songRows[i - 1].song.album.artist.name).should.be.true
}
wrapper.find('.song-list-header .artist').trigger('click')
wrapper.click('.song-list-header .artist')
for (let i = 1, j = wrapper.vm.songRows.length; i < j; ++i) {
(wrapper.vm.songRows[i].song.album.artist.name <= wrapper.vm.songRows[i - 1].song.album.artist.name).should.be.true
}
// album
wrapper.find('.song-list-header .album').trigger('click')
wrapper.click('.song-list-header .album')
for (let i = 1, j = wrapper.vm.songRows.length; i < j; ++i) {
(wrapper.vm.songRows[i].song.album.name >= wrapper.vm.songRows[i - 1].song.album.name).should.be.true
}
wrapper.find('.song-list-header .album').trigger('click')
wrapper.click('.song-list-header .album')
for (let i = 1, j = wrapper.vm.songRows.length; i < j; ++i) {
(wrapper.vm.songRows[i].song.album.name <= wrapper.vm.songRows[i - 1].song.album.name).should.be.true
}

View file

@ -12,7 +12,6 @@ describe('components/shared/song-menu', () => {
})
it('renders properly', () => {
const wrapper = shallow(Component, { propsData: { songs }})
const selectors = [
'.playback',
'.go-to-album',
@ -22,9 +21,7 @@ describe('components/shared/song-menu', () => {
'.top-queue',
'.favorite'
]
selectors.forEach(selector => {
wrapper.contains(selector).should.be.true
})
shallow(Component, { propsData: { songs }}).hasAll(...selectors).should.be.true
})
it('plays and pauses', () => {
@ -32,33 +29,29 @@ describe('components/shared/song-menu', () => {
})
it('queues songs after current', () => {
const wrapper = shallow(Component, { propsData: { songs }})
const queueStub = sinon.stub(queueStore, 'queueAfterCurrent')
wrapper.find('.after-current').trigger('click')
shallow(Component, { propsData: { songs }}).click('.after-current')
queueStub.calledWith(songs).should.be.true
queueStub.restore()
})
it('queues songs to bottom', () => {
const wrapper = shallow(Component, { propsData: { songs }})
const queueStub = sinon.stub(queueStore, 'queue')
wrapper.find('.bottom-queue').trigger('click')
shallow(Component, { propsData: { songs }}).click('.bottom-queue')
queueStub.calledWith(songs).should.be.true
queueStub.restore()
})
it('queues songs to top', () => {
const wrapper = shallow(Component, { propsData: { songs }})
const queueStub = sinon.stub(queueStore, 'queue')
wrapper.find('.top-queue').trigger('click')
shallow(Component, { propsData: { songs }}).click('.top-queue')
queueStub.calledWith(songs, false, true).should.be.true
queueStub.restore()
})
it('adds songs to favorite', () => {
const wrapper = shallow(Component, { propsData: { songs }})
const likeStub = sinon.stub(favoriteStore, 'like')
wrapper.find('.favorite').trigger('click')
shallow(Component, { propsData: { songs }}).click('.favorite')
likeStub.calledWith(songs).should.be.true
likeStub.restore()
})
@ -71,7 +64,7 @@ describe('components/shared/song-menu', () => {
playlistStore.all.forEach(playlist => {
html.should.contain(playlist.name)
})
wrapper.find('.playlist').trigger('click')
wrapper.click('.playlist')
addStub.calledWith(playlistStore.all[0], songs).should.be.true
addStub.restore()
})
@ -80,7 +73,7 @@ describe('components/shared/song-menu', () => {
const emitStub = sinon.stub(event, 'emit')
userStore.current.is_admin = true
const wrapper = shallow(Component, { propsData: { songs }})
wrapper.find('.open-edit-form').trigger('click')
wrapper.click('.open-edit-form')
emitStub.calledWith('songs:edit', songs).should.be.true
emitStub.restore()
})
@ -89,7 +82,7 @@ describe('components/shared/song-menu', () => {
const downloadStub = sinon.stub(download, 'fromSongs')
sharedStore.state.allowDownload = true
const wrapper = shallow(Component, { propsData: { songs }})
wrapper.find('.download').trigger('click')
wrapper.click('.download')
downloadStub.calledWith(songs).should.be.true
downloadStub.restore()
})
@ -103,7 +96,7 @@ describe('components/shared/song-menu', () => {
copyable: true
}
})
wrapper.find('.copy-url').trigger('click')
wrapper.click('.copy-url')
getUrlStub.calledWith(song).should.be.true
})
})

View file

@ -4,8 +4,7 @@ import { $ } from '@/utils'
describe('components/shared/to-top-button', () => {
it('scrolls to top', () => {
const scrollToStub = sinon.stub($, 'scrollTo')
const wrapper = shallow(Component)
wrapper.find('button').trigger('click')
shallow(Component).click('button')
scrollToStub.called.should.be.true
scrollToStub.restore()
})

View file

@ -52,7 +52,7 @@ describe('componnents/shared/track-list-item', () => {
track,
album,
index: 1
}}).find('li').trigger('click')
}}).click('li')
containsStub.calledWith(song).should.be.true
queueStub.calledWith(song).should.be.true

View file

@ -22,34 +22,34 @@ describe('components/shared/user-item', () => {
html.should.contain(user.avatar)
html.should.contain(user.name)
wrapper.find('.btn-edit').text().should.equal('Edit')
wrapper.contains('.btn-delete').should.be.true
wrapper.has('.btn-delete').should.be.true
})
it('has different behaviors if current user', () => {
userStore.current.id = user.id
const wrapper = shallow(Component, { propsData: { user }})
wrapper.contains('.btn-delete').should.be.false
wrapper.has('.btn-delete').should.be.false
wrapper.find('.btn-edit').text().should.equal('Update Profile')
})
it('redirects to update profile if attempt to edit current user', () => {
const goStub = sinon.stub(router, 'go')
userStore.current.id = user.id
shallow(Component, { propsData: { user }}).find('.btn-edit').trigger('click')
shallow(Component, { propsData: { user }}).click('.btn-edit')
goStub.calledWith('profile').should.be.true
goStub.restore()
})
it('edits user', () => {
const wrapper = shallow(Component, { propsData: { user }})
wrapper.find('.btn-edit').trigger('click')
wrapper.emitted().editUser[0].should.eql([user])
shallow(Component, { propsData: {
user
}}).click('.btn-edit').hasEmitted('editUser', user).should.be.true
})
it('triggers deleting user', () => {
const confirmStub = sinon.stub(alerts, 'confirm')
const wrapper = shallow(Component, { propsData: { user }})
wrapper.find('.btn-delete').trigger('click')
wrapper.click('.btn-delete')
confirmStub.calledWith(
`Youre about to unperson ${user.name}. Are you sure?`,
wrapper.vm.doDelete

View file

@ -6,9 +6,7 @@ describe('components/shared/view-mode-switch', () => {
mode: 'list',
for: 'albums'
}})
wrapper.find('a.thumbnails').trigger('click')
wrapper.emitted().viewModeChanged[0].should.eql(['thumbnails'])
wrapper.find('a.list').trigger('click')
wrapper.emitted().viewModeChanged[1].should.eql(['list'])
wrapper.click('a.thumbnails').hasEmitted('viewModeChanged', 'thumbnails').should.be.true
wrapper.click('a.list').hasEmitted('viewModeChanged', 'list').should.be.true
})
})

View file

@ -3,15 +3,13 @@ import { event } from '@/utils'
describe('components/site-header/search-form', () => {
it('renders properly', () => {
shallow(Component).contains('[type=search]').should.be.true
shallow(Component).has('[type=search]').should.be.true
})
it('emits an event to filter', async done => {
const emitStub = sinon.stub(event, 'emit')
const wrapper = shallow(Component)
const input = wrapper.find('[type=search]')
input.element.value = 'foo'
input.trigger('input')
wrapper.find('[type=search]').setValue('foo').input()
setTimeout(() => {
emitStub.calledWith('filter:changed', 'foo').should.be.true
emitStub.restore()

View file

@ -4,13 +4,12 @@ import { playback, socket } from '@/services'
describe('components/site-footer/volume', () => {
it('renders properly', () => {
const wrapper = shallow(Component)
wrapper.contains('i.mute').should.be.true
wrapper.contains('#volumeRange').should.be.true
wrapper.hasAll('i.mute', '#volumeRange').should.be.true
})
it('mutes', () => {
const muteStub = sinon.stub(playback, 'mute')
shallow(Component).find('i.mute').trigger('click')
shallow(Component).click('i.mute')
muteStub.called.should.be.true
muteStub.restore()
})
@ -19,25 +18,21 @@ describe('components/site-footer/volume', () => {
const unmuteStub = sinon.stub(playback, 'unmute')
shallow(Component, { data: {
muted: true
}}).find('i.unmute').trigger('click')
}}).click('i.unmute')
unmuteStub.called.should.be.true
unmuteStub.restore()
})
it('sets the volume', () => {
const setVolumeStub = sinon.stub(playback, 'setVolume')
const input = shallow(Component).find('#volumeRange')
input.element.value = 4.2
input.trigger('input')
shallow(Component).find('#volumeRange').setValue(4.2).input()
setVolumeStub.calledWith(4.2).should.be.true
setVolumeStub.restore()
})
it('broadcasts the volume value', () => {
const broadcastStub = sinon.stub(socket, 'broadcast')
const input = shallow(Component).find('#volumeRange')
input.element.value = 4.2
input.trigger('change')
shallow(Component).find('#volumeRange').setValue(4.2).change()
broadcastStub.calledWith('volume:changed', 4.2).should.be.true
broadcastStub.restore()
})

View file

@ -6,12 +6,11 @@ require('babel-polyfill')
require('chai').should()
require('vue-test-helpers')()
// make common utils available globally as well
global.Vue = require('vue')
global.expect = require('expect')
global.sinon = require('sinon')
global._ = require('lodash')
const testUtils = require('vue-test-utils')
global.shallow = testUtils.shallow
global.mount = testUtils.mount
window.__UNIT_TESTING__ = true

566
yarn.lock

File diff suppressed because it is too large Load diff