Merge branch 'master'
[arvados.git] / src / store / collections / creator / collection-creator-reducer.test.ts
1 // Copyright (C) The Arvados Authors. All rights reserved.
2 //
3 // SPDX-License-Identifier: AGPL-3.0
4
5 import { collectionCreatorReducer } from "./collection-creator-reducer";
6 import { collectionCreateActions } from "./collection-creator-action";
7
8 describe('collection-reducer', () => {
9
10     it('should open collection creator dialog', () => {
11         const initialState = { opened: false, ownerUuid: "" };
12         const collection = { opened: true, ownerUuid: "" };
13
14         const state = collectionCreatorReducer(initialState, collectionCreateActions.OPEN_COLLECTION_CREATOR(initialState));
15         expect(state).toEqual(collection);
16     });
17
18     it('should close collection creator dialog', () => {
19         const initialState = { opened: true, ownerUuid: "" };
20         const collection = { opened: false, ownerUuid: "" };
21
22         const state = collectionCreatorReducer(initialState, collectionCreateActions.CLOSE_COLLECTION_CREATOR());
23         expect(state).toEqual(collection);
24     });
25
26     it('should reset collection creator dialog props', () => {
27         const initialState = { opened: true, ownerUuid: "test" };
28         const collection = { opened: false, ownerUuid: "" };
29
30         const state = collectionCreatorReducer(initialState, collectionCreateActions.CREATE_COLLECTION_SUCCESS());
31         expect(state).toEqual(collection);
32     });
33 });