21700: Install Bundler system-wide in Rails postinst
[arvados.git] / services / workbench2 / src / store / dialog / dialog-reducer.test.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { dialogReducer } from "./dialog-reducer";
6 import { dialogActions } from "./dialog-actions";
7
8 describe('DialogReducer', () => {
9     it('OPEN_DIALOG', () => {
10         const id = 'test id';
11         const data = 'test data';
12         const state = dialogReducer({}, dialogActions.OPEN_DIALOG({ id, data }));
13         expect(state[id]).toEqual({ open: true, data });
14     });
15
16     it('CLOSE_DIALOG', () => {
17         const id = 'test id';
18         const state = dialogReducer({}, dialogActions.CLOSE_DIALOG({ id }));
19         expect(state[id]).toEqual({ open: false, data: {} });
20     });
21     
22     it('CLOSE_DIALOG persist data', () => {
23         const id = 'test id';
24         const [newState] = [{}]
25             .map(state => dialogReducer(state, dialogActions.OPEN_DIALOG({ id, data: 'test data' })))
26             .map(state => dialogReducer(state, dialogActions.CLOSE_DIALOG({ id })));
27         
28         expect(newState[id]).toEqual({ open: false, data: 'test data' });
29     });
30 });