[ARVADOS-WORKBENCH2] updated: 2.1.0-297-gef8e39a7

Git user git at public.arvados.org
Fri Apr 9 21:23:09 UTC 2021


Summary of changes:
 src/services/api/filter-builder.ts                 |  3 +
 .../workflow-panel/workflow-panel-actions.test.ts  | 80 ++++++++++++++++++++++
 2 files changed, 83 insertions(+)
 create mode 100644 src/store/workflow-panel/workflow-panel-actions.test.ts

       via  ef8e39a770f9c27a73553ac6fba524c790d644fd (commit)
      from  a6c092fe45fe0ff310800e82e224bc822890491a (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.


commit ef8e39a770f9c27a73553ac6fba524c790d644fd
Author: Peter Amstutz <peter.amstutz at curii.com>
Date:   Fri Apr 9 17:22:51 2021 -0400

    17427: Add unit test for openRunProcess()
    
    Arvados-DCO-1.1-Signed-off-by: Peter Amstutz <peter.amstutz at curii.com>

diff --git a/src/services/api/filter-builder.ts b/src/services/api/filter-builder.ts
index 489f7b89..d1a4fd08 100644
--- a/src/services/api/filter-builder.ts
+++ b/src/services/api/filter-builder.ts
@@ -60,6 +60,9 @@ export class FilterBuilder {
     public addExists(value?: string, resourcePrefix?: string) {
         return this.addCondition("properties", "exists", value, "", "", resourcePrefix);
     }
+    public addDoesNotExist(field: string, resourcePrefix?: string) {
+        return this.addCondition("properties." + field, "exists", false, "", "", resourcePrefix);
+    }
 
     public addFullTextSearch(value: string) {
         const terms = value.trim().split(/(\s+)/);
diff --git a/src/store/workflow-panel/workflow-panel-actions.test.ts b/src/store/workflow-panel/workflow-panel-actions.test.ts
new file mode 100644
index 00000000..86dba452
--- /dev/null
+++ b/src/store/workflow-panel/workflow-panel-actions.test.ts
@@ -0,0 +1,80 @@
+// Copyright (C) The Arvados Authors. All rights reserved.
+//
+// SPDX-License-Identifier: AGPL-3.0
+
+import { getNewExtraToken, initAuth } from "./auth-action";
+import { API_TOKEN_KEY } from "~/services/auth-service/auth-service";
+
+import 'jest-localstorage-mock';
+import { ServiceRepository, createServices } from "~/services/services";
+import { configureStore, RootStore } from "../store";
+import { createBrowserHistory } from "history";
+import { Config, mockConfig } from '~/common/config';
+import { ApiActions } from "~/services/api/api-actions";
+import { ACCOUNT_LINK_STATUS_KEY } from '~/services/link-account-service/link-account-service';
+import Axios from "axios";
+import MockAdapter from "axios-mock-adapter";
+import { ImportMock } from 'ts-mock-imports';
+import * as servicesModule from "~/services/services";
+import { SessionStatus } from "~/models/session";
+import { openRunProcess } from './workflow-panel-actions';
+import { runProcessPanelActions } from '~/store/run-process-panel/run-process-panel-actions';
+import { initialize } from 'redux-form';
+import { RUN_PROCESS_BASIC_FORM } from '~/views/run-process-panel/run-process-basic-form';
+import { RUN_PROCESS_INPUTS_FORM } from '~/views/run-process-panel/run-process-inputs-form';
+
+describe('workflow-panel-actions', () => {
+    const axiosInst = Axios.create({ headers: {} });
+    const axiosMock = new MockAdapter(axiosInst);
+
+    let store: RootStore;
+    let services: ServiceRepository;
+    const config: any = {};
+    const actions: ApiActions = {
+        progressFn: (id: string, working: boolean) => { },
+        errorFn: (id: string, message: string) => { }
+    };
+    let importMocks: any[];
+
+    beforeEach(() => {
+        axiosMock.reset();
+        services = createServices(mockConfig({}), actions, axiosInst);
+        store = configureStore(createBrowserHistory(), services, config);
+        localStorage.clear();
+        importMocks = [];
+    });
+
+    afterEach(() => {
+        importMocks.map(m => m.restore());
+    });
+
+    it('opens the run process panel', async () => {
+        const wflist = [{
+            uuid: "zzzzz-7fd4e-0123456789abcde",
+            name: "foo",
+            description: "",
+            definition: "$graph: []"
+        }];
+        axiosMock
+            .onGet("/workflows")
+            .reply(200, {
+                items: wflist
+            }).onGet("/links")
+            .reply(200, {
+                items: []
+            });
+
+        const dispatchMock = jest.fn();
+        const dispatchWrapper = (action: any) => {
+            dispatchMock(action);
+            return store.dispatch(action);
+        };
+
+        await openRunProcess("zzzzz-7fd4e-0123456789abcde", "zzzzz-tpzed-0123456789abcde", "testing", { inputparm: "value" })(dispatchWrapper, store.getState, services);
+        expect(dispatchMock).toHaveBeenCalledWith(runProcessPanelActions.SET_WORKFLOWS(wflist));
+        expect(dispatchMock).toHaveBeenCalledWith(runProcessPanelActions.SET_SELECTED_WORKFLOW(wflist[0]));
+        expect(dispatchMock).toHaveBeenCalledWith(runProcessPanelActions.SET_PROCESS_OWNER_UUID("zzzzz-tpzed-0123456789abcde"));
+        expect(dispatchMock).toHaveBeenCalledWith(initialize(RUN_PROCESS_BASIC_FORM, { name: "testing" }));
+        expect(dispatchMock).toHaveBeenCalledWith(initialize(RUN_PROCESS_INPUTS_FORM, { inputparm: "value" }));
+    });
+});

-----------------------------------------------------------------------


hooks/post-receive
-- 




More information about the arvados-commits mailing list