Add tests for lyrics sidebar

This commit is contained in:
Phan An 2017-12-11 21:49:48 +01:00
parent 282fd2cd15
commit 9b637c0726

View file

@ -0,0 +1,22 @@
import Lyrics from '@/components/main-wrapper/extra/lyrics.vue'
import song from '@/tests/blobs/song'
describe('components/main-wrapper/extra/lyrics', () => {
it('displays lyrics if the song has lyrics', () => {
const wrapper = shallow(Lyrics, {
propsData: { song }
})
wrapper.html().should.contain(song.lyrics)
})
it('displays a fallback message if the song has no lyrics', () => {
const songWithNoLyrics = _.clone(song)
songWithNoLyrics.lyrics = null
const wrapper = shallow(Lyrics, {
propsData: {
song: songWithNoLyrics
}
})
wrapper.html().should.contain('No lyrics found. Are you not listening to Bach?')
})
})