Commit e745e6ba authored by Joram Wilander's avatar Joram Wilander Committed by JoramWilander

MM-13520 Fix redirect to sign-up page when there are no user accounts (#2210)

* Fix redirect to sign-up page when there are no user accounts

* Move into afterIntl
parent ade41885
......@@ -184,6 +184,10 @@ export default class Root extends React.Component {
const afterIntl = () => {
initializePlugins();
if (this.props.location.pathname === '/' && this.props.noAccounts) {
this.props.history.push('/signup_user_complete');
}
this.setState({configLoaded: true});
};
if (global.Intl) {
......
......@@ -33,6 +33,27 @@ describe('components/Root', () => {
},
};
test('should load config and license on mount and redirect to sign-up page', () => {
const props = {
...baseProps,
noAccounts: true,
actions: {
...baseProps.actions,
loadMeAndConfig: jest.fn(async () => [{}, {}, {}]),
},
history: {
push: jest.fn(),
},
};
const wrapper = shallow(<Root {...props}/>);
expect(props.actions.loadMeAndConfig).toHaveBeenCalledTimes(1);
wrapper.instance().onConfigLoaded();
expect(props.history.push).toHaveBeenCalledWith('/signup_user_complete');
});
test('should load user, config, and license on mount and redirect to defaultTeam on success', (done) => {
const props = {
...baseProps,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment