[Workplace Search] Add source skips config step correctly (#128715)

This commit is contained in:
Sander Philipse 2022-03-29 12:31:05 +02:00 committed by GitHub
parent 43ad6e2597
commit bf2769d7ee
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 3 deletions

View file

@ -81,7 +81,10 @@ describe('AddSourceList', () => {
configured: true,
};
shallow(<AddSource sourceData={sourceData} />);
expect(initializeAddSource).toHaveBeenCalledWith(expect.objectContaining({ connect: true }));
expect(initializeAddSource).toHaveBeenNthCalledWith(
2,
expect.objectContaining({ connect: true })
);
});
it('renders default state correctly when there are multiple connector options', () => {

View file

@ -59,9 +59,9 @@ export const AddSource: React.FC<AddSourceProps> = (props) => {
// We can land on this page from a choice page for multiple types of connectors
// If that's the case we want to skip the intro and configuration, if the external & internal connector have already been configured
const goToConnect = externalConnectorAvailable && externalConfigured && configured;
initializeAddSource(goToConnect ? props : { ...props, connect: true });
initializeAddSource(goToConnect ? { ...props, connect: true } : props);
return resetSourceState;
}, []);
}, [configured]);
const goToConfigurationIntro = () => setAddSourceStep(AddSourceSteps.ConfigIntroStep);
const goToSaveConfig = () => setAddSourceStep(AddSourceSteps.SaveConfigStep);