Skip to content
Snippets Groups Projects
Commit b7cdbb35 authored by Karishma Chadha's avatar Karishma Chadha
Browse files

Add test for ensuring that cloud connection does not happen just because of a...

Add test for ensuring that cloud connection does not happen just because of a project id change. isShowingWithId must also be true.
parent eab9b74f
No related branches found
No related tags found
No related merge requests found
......@@ -116,4 +116,28 @@ describe('CloudManagerHOC', () => {
expect(vm.setCloudProvider.mock.calls.length).toBe(1);
expect(CloudProvider).toHaveBeenCalledTimes(1);
});
test('projectId change should not trigger cloudProvider connection unless isShowingWithId becomes true', () => {
const Component = () => <div />;
const WrappedComponent = cloudManagerHOC(Component);
const mounted = mount(
<WrappedComponent
cloudHost="nonEmpty"
store={stillLoadingStore}
username="user"
vm={vm}
/>
);
mounted.setProps({
projectId: 'a different id'
});
expect(vm.setCloudProvider.mock.calls.length).toBe(0);
expect(CloudProvider).not.toHaveBeenCalled();
mounted.setProps({
isShowingWithId: true,
loadingState: LoadingState.SHOWING_WITH_ID
});
expect(vm.setCloudProvider.mock.calls.length).toBe(1);
expect(CloudProvider).toHaveBeenCalledTimes(1);
});
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment