koel/resources/assets/js/tests/stores/artistTest.js

33 lines
907 B
JavaScript
Raw Normal View History

2016-11-26 03:25:35 +00:00
require('chai').should()
import { cloneDeep, last } from 'lodash'
2015-12-13 04:42:28 +00:00
2016-11-26 03:25:35 +00:00
import { artistStore } from '../../stores'
2017-04-25 14:09:32 +00:00
import data from '../blobs/data'
const artists = data.artists
2015-12-13 04:42:28 +00:00
describe('stores/artist', () => {
2016-11-26 03:25:35 +00:00
beforeEach(() => artistStore.init(cloneDeep(artists)))
afterEach(() => artistStore.state.artists = [])
2015-12-13 04:42:28 +00:00
2016-06-25 16:05:24 +00:00
describe('#init', () => {
it('correctly gathers artists', () => {
2017-04-25 14:09:32 +00:00
artistStore.state.artists.length.should.equal(5)
2016-11-26 03:25:35 +00:00
})
})
2015-12-13 04:42:28 +00:00
2017-04-25 14:09:32 +00:00
describe('#byId', () => {
it('correctly gets an artist by ID', () => {
artistStore.byId(3).name.should.equal('All-4-One')
2016-11-26 03:25:35 +00:00
})
})
2016-03-05 09:01:12 +00:00
2017-04-25 14:09:32 +00:00
describe('#compact', () => {
it('correctly compact artists', () => {
artistStore.compact()
// because we've not processed songs/albums, all artists here have no songs
// and should be removed after compact()ing
artistStore.state.artists.length.should.equal(0)
2016-11-26 03:25:35 +00:00
})
})
})