Skip to content

Commit

Permalink
fixup! Ask to start a workpspace from the default devfile, if the fac…
Browse files Browse the repository at this point in the history
…tory URL is unsupported
  • Loading branch information
vinokurig committed Mar 14, 2023
1 parent 248a02f commit 3226c50
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import { createMemoryHistory } from 'history';
import React from 'react';
import { Provider } from 'react-redux';
import { Action, Store } from 'redux';
import StepFetchDevfile, { State } from '..';
import StepFetchDevfile, { State, UnsupportedGitProviderError } from '..';
import { List, LoaderStep, LoadingStep } from '../../../../../../../components/Loader/Step';
import {
buildLoaderSteps,
Expand Down Expand Up @@ -134,6 +134,24 @@ describe('Factory Loader container, step CREATE_WORKSPACE__FETCH_DEVFILE', () =>
expect(mockOnRestart).toHaveBeenCalled();
});

test('unsupported git provider', async () => {
const localState: Partial<State> = {
lastError: new UnsupportedGitProviderError('Failed to fetch devfile'),
factoryParams: buildFactoryParams(searchParams),
};
renderComponent(store, loaderSteps, searchParams, currentStepIndex, localState);

jest.advanceTimersByTime(MIN_STEP_DURATION_MS);

const defaultDevfileButton = await screen.findByRole('button', {
name: 'Continue with the default devfile',
});
expect(defaultDevfileButton).toBeDefined();
userEvent.click(defaultDevfileButton);

await waitFor(() => expect(mockOnNextStep).toHaveBeenCalled());
});

test('no project url, remotes exist', async () => {
const store = new FakeStoreBuilder().build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ export class ApplyingDevfileError extends Error {
}
}

class UnsupportedGitProviderError extends Error {
export class UnsupportedGitProviderError extends Error {
constructor(message) {
super(message);
this.name = 'UnsupportedGitProviderError';
Expand Down

0 comments on commit 3226c50

Please sign in to comment.