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

38 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', () => {
beforeEach(() => {
albumStore.init(artists);
});
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…
});
});
});