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

36 lines
1 KiB
JavaScript
Raw Normal View History

2015-12-13 04:42:28 +00:00
require('chai').should();
import albumStore from '../../stores/album';
import artists from '../blobs/media';
describe('stores/album', () => {
2015-12-14 13:13:12 +00:00
beforeEach(() => albumStore.init(artists));
2015-12-13 04:42:28 +00:00
describe('#init', () => {
it('correctly gathers albums', () => {
albumStore.state.albums.length.should.equal(7);
});
it('correctly sets albums length', () => {
albumStore.state.albums[0].length.should.equal(259.92);
});
it('correctly sets album artists', () => {
albumStore.state.albums[0].artist.id.should.equal(1);
});
});
describe('#all', () => {
it('correctly returns all songs', () => {
albumStore.all().length.should.equal(7);
});
});
describe('#getLength', () => {
it('correctly calculates an albums length', () => {
albumStore.getLength(albumStore.state.albums[6]);
albumStore.state.albums[6].length.should.equal(1940.42); // I'm sorry…
});
});
});