X-Git-Url: https://git.arvados.org/arvados.git/blobdiff_plain/e136acc6897312f1b82e47fe038aba806855988c..44c8f9ed561513b607d3eca752ad3e1efd376f56:/services/workbench2/src/views/process-panel/process-io-card.test.tsx

diff --git a/services/workbench2/src/views/process-panel/process-io-card.test.tsx b/services/workbench2/src/views/process-panel/process-io-card.test.tsx
index a1ee7d61fa..ff1ec24de1 100644
--- a/services/workbench2/src/views/process-panel/process-io-card.test.tsx
+++ b/services/workbench2/src/views/process-panel/process-io-card.test.tsx
@@ -5,21 +5,21 @@
 import React from 'react';
 import { mount, configure } from 'enzyme';
 import { combineReducers, createStore } from "redux";
-import { CircularProgress, MuiThemeProvider, Tab, TableBody, TableCell } from "@material-ui/core";
+import { CircularProgress, MuiThemeProvider, Tab, TableBody } from "@material-ui/core";
 import { CustomTheme } from 'common/custom-theme';
 import Adapter from "enzyme-adapter-react-16";
 import { Provider } from 'react-redux';
-import configureMockStore from 'redux-mock-store'
 import { ProcessIOCard, ProcessIOCardType } from './process-io-card';
 import { DefaultView } from "components/default-view/default-view";
 import { DefaultCodeSnippet } from "components/default-code-snippet/default-code-snippet";
 import { ProcessOutputCollectionFiles } from './process-output-collection-files';
 import { MemoryRouter } from 'react-router-dom';
 
-
-const middlewares = [];
-const mockStore = configureMockStore(middlewares);
+// Mock collection files component since it just needs to exist
 jest.mock('views/process-panel/process-output-collection-files');
+// Mock autosizer for the io panel virtual list
+jest.mock('react-virtualized-auto-sizer', () => ({ children }: any) => children({ height: 600, width: 600 }));
+
 configure({ adapter: new Adapter() });
 
 describe('renderers', () => {
@@ -116,7 +116,7 @@ describe('renderers', () => {
 
         it('shows main process with params', () => {
             // when
-            const parameters = [{id: 'someId', label: 'someLabel', value: [{display: 'someValue'}]}];
+            const parameters = [{id: 'someId', label: 'someLabel', value: {display: 'someValue'}}];
             let panel = mount(
                 <Provider store={store}>
                     <MuiThemeProvider theme={CustomTheme}>
@@ -208,7 +208,32 @@ describe('renderers', () => {
 
             // then
             expect(panel.find(CircularProgress).exists()).toBeFalsy();
-            expect(panel.find(Tab).length).toBe(1); // Empty raw is hidden in subprocesses
+            expect(panel.find(Tab).length).toBe(1); // Unloaded raw is hidden in subprocesses
+            expect(panel.find(ProcessOutputCollectionFiles).prop('currentItemUuid')).toBe(outputCollection);
+        });
+
+        it('shows empty subprocess raw', () => {
+            // when
+            const subprocess = {containerRequest: {requestingContainerUuid: 'xyz'}};
+            const outputCollection = '123456789';
+            let panel = mount(
+                <Provider store={store}>
+                    <MuiThemeProvider theme={CustomTheme}>
+                        <ProcessIOCard
+                            label={ProcessIOCardType.OUTPUT}
+                            process={subprocess} // Treat as a subprocess with outputUuid
+                            outputUuid={outputCollection}
+                            params={null}
+                            raw={{}}
+                        />
+                    </MuiThemeProvider>
+                </Provider>
+                );
+
+            // then
+            expect(panel.find(CircularProgress).exists()).toBeFalsy();
+            expect(panel.find(Tab).length).toBe(2); // Empty raw is visible in subprocesses
+            expect(panel.find(Tab).first().text()).toBe('Collection');
             expect(panel.find(ProcessOutputCollectionFiles).prop('currentItemUuid')).toBe(outputCollection);
         });
 
