This repository has been archived on 2022-08-14. You can view files and clone it, but cannot push or open issues or pull requests.
outline/app/stores/UiStore.test.js

28 lines
650 B
JavaScript
Raw Normal View History

2018-05-31 18:42:39 +00:00
/* eslint-disable */
2018-06-01 04:01:06 +00:00
import stores from '.';
2018-05-31 18:42:39 +00:00
// Actions
describe('UiStore', () => {
let store;
beforeEach(() => {
2018-06-01 04:01:06 +00:00
store = new stores.UiStore();
2018-05-31 18:42:39 +00:00
});
test('#add should add errors', () => {
expect(store.data.length).toBe(0);
store.showToast('first error');
store.showToast('second error');
expect(store.toasts.length).toBe(2);
});
test('#remove should remove errors', () => {
store.showToast('first error');
store.showToast('second error');
expect(store.toasts.length).toBe(2);
store.removeToast(0);
expect(store.toasts.length).toBe(1);
expect(store.toasts[0]).toBe('second error');
});
});