1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { dialogReducer } from "./dialog-reducer";
6 import { dialogActions } from "./dialog-actions";
8 describe('DialogReducer', () => {
9 it('OPEN_DIALOG', () => {
11 const data = 'test data';
12 const state = dialogReducer({}, dialogActions.OPEN_DIALOG({ id, data }));
13 expect(state[id]).toEqual({ open: true, data });
16 it('CLOSE_DIALOG', () => {
18 const state = dialogReducer({}, dialogActions.CLOSE_DIALOG({ id }));
19 expect(state[id]).toEqual({ open: false, data: {} });
22 it('CLOSE_DIALOG persist data', () => {
24 const [newState] = [{}]
25 .map(state => dialogReducer(state, dialogActions.OPEN_DIALOG({ id, data: 'test data' })))
26 .map(state => dialogReducer(state, dialogActions.CLOSE_DIALOG({ id })));
28 expect(newState[id]).toEqual({ open: false, data: 'test data' });