Fix tests
This commit is contained in:
parent
619d298547
commit
1e2b0c9eee
|
@ -1,20 +0,0 @@
|
|||
import {
|
||||
AUTH_LOGGED_OUT,
|
||||
logOut,
|
||||
} from '../auth';
|
||||
import { ALERT_SHOW } from '../alerts';
|
||||
import { Map as ImmutableMap } from 'immutable';
|
||||
import { mockStore } from 'soapbox/test_helpers';
|
||||
|
||||
describe('logOut()', () => {
|
||||
it('creates expected actions', () => {
|
||||
const expectedActions = [
|
||||
{ type: AUTH_LOGGED_OUT },
|
||||
{ type: ALERT_SHOW, message: 'Logged out.', severity: 'success' },
|
||||
];
|
||||
const store = mockStore(ImmutableMap());
|
||||
|
||||
store.dispatch(logOut());
|
||||
return expect(store.getActions()).toEqual(expectedActions);
|
||||
});
|
||||
});
|
|
@ -64,4 +64,66 @@ exports[`<LoginPage /> renders correctly on load 1`] = `
|
|||
</form>
|
||||
`;
|
||||
|
||||
exports[`<LoginPage /> renders correctly on load 2`] = `null`;
|
||||
exports[`<LoginPage /> renders correctly on load 2`] = `
|
||||
<form
|
||||
className="simple_form new_user"
|
||||
method="post"
|
||||
onSubmit={[Function]}
|
||||
>
|
||||
<fieldset
|
||||
disabled={false}
|
||||
>
|
||||
<div
|
||||
className="fields-group"
|
||||
>
|
||||
<div
|
||||
className="input email user_email"
|
||||
>
|
||||
<input
|
||||
aria-label="Username"
|
||||
autoComplete="off"
|
||||
className="string email"
|
||||
name="username"
|
||||
placeholder="Username"
|
||||
required={true}
|
||||
type="text"
|
||||
/>
|
||||
</div>
|
||||
<div
|
||||
className="input password user_password"
|
||||
>
|
||||
<input
|
||||
aria-label="Password"
|
||||
autoComplete="off"
|
||||
className="password"
|
||||
name="password"
|
||||
placeholder="Password"
|
||||
required={true}
|
||||
type="password"
|
||||
/>
|
||||
</div>
|
||||
<p
|
||||
className="hint subtle-hint"
|
||||
>
|
||||
<a
|
||||
href="/auth/reset_password"
|
||||
onClick={[Function]}
|
||||
>
|
||||
Trouble logging in?
|
||||
</a>
|
||||
</p>
|
||||
</div>
|
||||
</fieldset>
|
||||
<div
|
||||
className="actions"
|
||||
>
|
||||
<button
|
||||
className="btn button button-primary"
|
||||
name="button"
|
||||
type="submit"
|
||||
>
|
||||
Log in
|
||||
</button>
|
||||
</div>
|
||||
</form>
|
||||
`;
|
||||
|
|
|
@ -69,6 +69,7 @@ const migrateLegacy = state => {
|
|||
return state.withMutations(state => {
|
||||
const app = fromJS(JSON.parse(localStorage.getItem('soapbox:auth:app')));
|
||||
const user = fromJS(JSON.parse(localStorage.getItem('soapbox:auth:user')));
|
||||
if (!user) return;
|
||||
state.set('me', '_legacy'); // Placeholder account ID
|
||||
state.set('app', app);
|
||||
state.set('tokens', ImmutableMap({
|
||||
|
|
Loading…
Reference in New Issue