1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import { collectionCreatorReducer } from "./collection-creator-reducer";
6 import { collectionCreateActions } from "./collection-creator-action";
8 describe('collection-reducer', () => {
10 it('should open collection creator dialog', () => {
11 const initialState = { opened: false, ownerUuid: "" };
12 const collection = { opened: true, ownerUuid: "" };
14 const state = collectionCreatorReducer(initialState, collectionCreateActions.OPEN_COLLECTION_CREATOR(initialState));
15 expect(state).toEqual(collection);
18 it('should close collection creator dialog', () => {
19 const initialState = { opened: true, ownerUuid: "" };
20 const collection = { opened: false, ownerUuid: "" };
22 const state = collectionCreatorReducer(initialState, collectionCreateActions.CLOSE_COLLECTION_CREATOR());
23 expect(state).toEqual(collection);
26 it('should reset collection creator dialog props', () => {
27 const initialState = { opened: true, ownerUuid: "test" };
28 const collection = { opened: false, ownerUuid: "" };
30 const state = collectionCreatorReducer(initialState, collectionCreateActions.CREATE_COLLECTION_SUCCESS());
31 expect(state).toEqual(collection);