-
- expect(localStorage.getItem(API_TOKEN_KEY)).toBe("token");
- });
-
- it('should fire external url to login', () => {
- const initialState = undefined;
-
- const location = {
- href: 'http://localhost:3000',
- protocol: 'http:',
- host: 'localhost:3000'
- };
-
- global['window'] = { location };
-
- authReducer(initialState, actions.LOGIN());
- expect(window.location.href).toBe(
- `${API_HOST}/login?return_to=${location.protocol}//${location.host}/token`
- );
- });
-
- it('should fire external url to logout', () => {
- const initialState = undefined;
-
- const location = {
- href: 'http://localhost:3000',
- protocol: 'http:',
- host: 'localhost:3000'
- };
-
- global['window'] = { location };
-
- authReducer(initialState, actions.LOGOUT());
- expect(window.location.href).toBe(
- `${API_HOST}/logout?return_to=${location.protocol}//${location.host}`
- );