1 // Copyright (C) The Arvados Authors. All rights reserved.
3 // SPDX-License-Identifier: AGPL-3.0
5 import collectionsReducer from "./collection-reducer";
6 import actions from "./collection-action";
7 import { ResourceKind } from "../../models/resource";
9 describe('collection-reducer', () => {
10 it('should add new collection to the list', () => {
11 const initialState = undefined;
15 createdAt: '2018-01-01',
16 modifiedAt: '2018-01-01',
17 ownerUuid: 'owner-test123',
19 kind: ResourceKind.COLLECTION
22 const state = collectionsReducer(initialState, actions.CREATE_COLLECTION(collection));
23 expect(state).toEqual([collection]);
26 it('should load collections', () => {
27 const initialState = undefined;
31 createdAt: '2018-01-01',
32 modifiedAt: '2018-01-01',
33 ownerUuid: 'owner-test123',
35 kind: ResourceKind.COLLECTION
38 const collections = [collection, collection];
39 const state = collectionsReducer(initialState, actions.COLLECTIONS_SUCCESS({ collections }));
40 expect(state).toEqual([collection, collection]);