20609: Add unit tests for subprocess progress bar, includes node/dom upgrade to 16...
[arvados.git] / src / store / tree-picker / tree-picker-actions.test.ts
index b1c42409ecc606fb307f67b3d72610a54f8a23cf..7a55503e20f7b2968ea05b3678591a58e262f1bd 100644 (file)
@@ -14,6 +14,8 @@ import { SHARED_PROJECT_ID, initProjectsTreePicker } from "./tree-picker-actions
 import { CollectionResource } from "models/collection";
 import { GroupResource } from "models/group";
 import { CollectionDirectory, CollectionFile, CollectionFileType } from "models/collection-file";
+import { GroupContentsResource } from "services/groups-service/groups-service";
+import { ListResults } from "services/common-service/common-service";
 
 describe('tree-picker-actions', () => {
     const axiosInst = Axios.create({ headers: {} });
@@ -21,10 +23,7 @@ describe('tree-picker-actions', () => {
 
     let store: RootStore;
     let services: ServiceRepository;
-    const config: any = {
-
-
-    };
+    const config: any = {};
     const actions: ApiActions = {
         progressFn: (id: string, working: boolean) => { },
         errorFn: (id: string, message: string) => { }
@@ -123,6 +122,11 @@ describe('tree-picker-actions', () => {
             return fakeResources[uuid]?.files || [];
         });
 
+        services.groupsService.contents = jest.fn(async (uuid, args) => {
+            const items = Object.keys(fakeResources).map(uuid => ({...fakeResources[uuid], uuid})).filter(item => item.ownerUuid === uuid);
+            return {items: items as GroupContentsResource[], itemsAvailable: items.length} as ListResults<GroupContentsResource>;
+        });
+
         const pickerId = "pickerId";
 
         // When collection preselected