import {VSPComponentsFactory} from 'test-utils/factories/softwareProduct/SoftwareProductComponentsFactories.js';
import {FinalizedLicenseModelFactory} from 'test-utils/factories/licenseModel/LicenseModelFactories.js';
+import { Provider } from 'react-redux';
+import {storeCreator} from 'sdc-app/AppStore.js';
import {mapStateToProps} from 'sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPage.js';
import SoftwareProductLandingPageView from 'sdc-app/onboarding/softwareProduct/landingPage/SoftwareProductLandingPageView.jsx';
componentsList: VSPComponentsFactory.buildList(2)
};
- let vspLandingView = TestUtils.renderIntoDocument(<SoftwareProductLandingPageView
- {...params}/>);
+ const store = storeCreator();
+ let vspLandingView = TestUtils.renderIntoDocument(<Provider store={store}><SoftwareProductLandingPageView
+ {...params}/></Provider>);
expect(vspLandingView).toBeTruthy();
});
componentsList: VSPComponentsFactory.buildList(2)
};
- let vspLandingView = TestUtils.renderIntoDocument(<SoftwareProductLandingPageView
- {...params}/>);
+ const store = storeCreator();
+ let vspLandingView = TestUtils.renderIntoDocument(<Provider store={store}><SoftwareProductLandingPageView
+ {...params}/></Provider>);
+ let vspLandingViewWrapper = TestUtils.findRenderedComponentWithType(
+ vspLandingView,
+ SoftwareProductLandingPageView
+ );
expect(vspLandingView).toBeTruthy();
- vspLandingView.handleOnDragEnter(false);
- expect(vspLandingView.state.dragging).toEqual(true);
+ vspLandingViewWrapper.handleOnDragEnter(false);
+ expect(vspLandingViewWrapper.state.dragging).toEqual(true);
});
onUpload: dummyFunc,
onInvalidFileSizeUpload: dummyFunc
};
-
- let vspLandingView = TestUtils.renderIntoDocument(<SoftwareProductLandingPageView
- {...params}/>);
- expect(vspLandingView).toBeTruthy();
+
const files = [
{
name: 'aaa',
}
];
- vspLandingView.handleImportSubmit(files, false);
- expect(vspLandingView.state.dragging).toEqual(false);
- expect(vspLandingView.state.fileName).toEqual(files[0].name);
+ const store = storeCreator();
+
+ let vspLandingView = TestUtils.renderIntoDocument(<Provider store={store}><SoftwareProductLandingPageView {...params}/></Provider>);
+ let vspLandingViewWrapper = TestUtils.findRenderedComponentWithType(
+ vspLandingView,
+ SoftwareProductLandingPageView
+ );
+ expect(vspLandingView).toBeTruthy();
+ vspLandingViewWrapper.handleImportSubmit(files, false);
+ expect(vspLandingViewWrapper.state.dragging).toEqual(false);
+ expect(vspLandingViewWrapper.state.fileName).toEqual(files[0].name);
const files1 = [
{
name: 'bbb',
size: 0
}
];
- vspLandingView.handleImportSubmit(files1, false);
+ vspLandingViewWrapper.handleImportSubmit(files1, false);
});
it('vsp landing handleImportSubmit with damaged file test ', () => {
onInvalidFileSizeUpload: dummyFunc
};
- let vspLandingView = TestUtils.renderIntoDocument(<SoftwareProductLandingPageView
- {...params}/>);
+ const store = storeCreator();
+
+ let vspLandingView = TestUtils.renderIntoDocument(<Provider store={store}><SoftwareProductLandingPageView
+ {...params}/></Provider>);
+
+ let vspLandingViewWrapper = TestUtils.findRenderedComponentWithType(
+ vspLandingView,
+ SoftwareProductLandingPageView
+ );
expect(vspLandingView).toBeTruthy();
const files = [
{
}
];
- vspLandingView.handleImportSubmit(files, false);
- expect(vspLandingView.state.dragging).toEqual(false);
- expect(vspLandingView.state.fileName).toEqual('');
+ vspLandingViewWrapper.handleImportSubmit(files, false);
+ expect(vspLandingViewWrapper.state.dragging).toEqual(false);
+ expect(vspLandingViewWrapper.state.fileName).toEqual('');
});
});