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
Tom Moor 6fb51eb7bb 💚
2019-01-09 22:59:39 -08:00

29 lines
726 B
JavaScript

/* eslint-disable */
import stores from '.';
// Actions
describe('UiStore', () => {
let store;
beforeEach(() => {
store = stores.ui;
});
test('#add should add messages', () => {
expect(store.orderedToasts.length).toBe(0);
store.showToast('first error');
store.showToast('second error');
expect(store.orderedToasts.length).toBe(2);
});
test('#remove should remove messages', () => {
store.toasts.clear();
const id = store.showToast('first error');
store.showToast('second error');
expect(store.orderedToasts.length).toBe(2);
store.removeToast(id);
expect(store.orderedToasts.length).toBe(1);
expect(store.orderedToasts[0].message).toBe('second error');
});
});