2015-12-13 04:42:28 +00:00
|
|
|
require('chai').should();
|
|
|
|
|
|
|
|
import localStorage from 'local-storage';
|
|
|
|
import preferenceStore from '../../stores/preference';
|
|
|
|
|
2016-03-28 13:38:14 +00:00
|
|
|
const user = { id: 0 };
|
|
|
|
const preferences = {
|
2015-12-13 04:42:28 +00:00
|
|
|
volume: 8,
|
|
|
|
notify: false,
|
|
|
|
};
|
|
|
|
|
|
|
|
describe('stores/preference', () => {
|
|
|
|
beforeEach(() => {
|
|
|
|
localStorage.set(`preferences_${user.id}`, preferences);
|
|
|
|
preferenceStore.init(user);
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("#set", () => {
|
|
|
|
it('correctly sets preferences', () => {
|
|
|
|
preferenceStore.set('volume', 5);
|
|
|
|
localStorage.get(`preferences_${user.id}`).volume.should.equal(5);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
describe("#get", () => {
|
|
|
|
it('returns correct preference values', () => {
|
|
|
|
preferenceStore.get('volume').should.equal(8);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|