👕
This commit is contained in:
@@ -6,22 +6,23 @@ describe('UiStore', () => {
|
|||||||
let store;
|
let store;
|
||||||
|
|
||||||
beforeEach(() => {
|
beforeEach(() => {
|
||||||
store = new stores.UiStore();
|
store = stores.ui;
|
||||||
});
|
});
|
||||||
|
|
||||||
test('#add should add errors', () => {
|
test('#add should add errors', () => {
|
||||||
expect(store.data.length).toBe(0);
|
expect(store.toasts.length).toBe(0);
|
||||||
store.showToast('first error');
|
store.showToast('first error');
|
||||||
store.showToast('second error');
|
store.showToast('second error');
|
||||||
expect(store.toasts.length).toBe(2);
|
expect(store.toasts.length).toBe(2);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('#remove should remove errors', () => {
|
test('#remove should remove errors', () => {
|
||||||
|
store.toasts = [];
|
||||||
store.showToast('first error');
|
store.showToast('first error');
|
||||||
store.showToast('second error');
|
store.showToast('second error');
|
||||||
expect(store.toasts.length).toBe(2);
|
expect(store.toasts.length).toBe(2);
|
||||||
store.removeToast(0);
|
store.removeToast(0);
|
||||||
expect(store.toasts.length).toBe(1);
|
expect(store.toasts.length).toBe(1);
|
||||||
expect(store.toasts[0]).toBe('second error');
|
expect(store.toasts[0].message).toBe('second error');
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user