mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Remove change password auth panel
This commit is contained in:
@@ -12,8 +12,6 @@ import ActivationState from 'services/authFlow/ActivationState';
|
||||
import ResendActivationState from 'services/authFlow/ResendActivationState';
|
||||
import LoginState from 'services/authFlow/LoginState';
|
||||
|
||||
// TODO: navigate and state switching
|
||||
|
||||
describe('AuthFlow', () => {
|
||||
let flow;
|
||||
let actions;
|
||||
@@ -178,7 +176,6 @@ describe('AuthFlow', () => {
|
||||
'/': LoginState,
|
||||
'/login': LoginState,
|
||||
'/password': LoginState,
|
||||
'/change-password': LoginState,
|
||||
'/accept-rules': LoginState,
|
||||
'/oauth/permissions': LoginState,
|
||||
'/oauth/finish': LoginState,
|
||||
|
||||
@@ -1,86 +0,0 @@
|
||||
import ChangePasswordState from 'services/authFlow/ChangePasswordState';
|
||||
import CompleteState from 'services/authFlow/CompleteState';
|
||||
|
||||
import { bootstrap, expectState, expectNavigate, expectRun } from './helpers';
|
||||
|
||||
describe('ChangePasswordState', () => {
|
||||
let state;
|
||||
let context;
|
||||
let mock;
|
||||
|
||||
beforeEach(() => {
|
||||
state = new ChangePasswordState();
|
||||
|
||||
const data = bootstrap();
|
||||
context = data.context;
|
||||
mock = data.mock;
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
mock.verify();
|
||||
});
|
||||
|
||||
describe('#enter', () => {
|
||||
it('should navigate to /change-password', () => {
|
||||
context.getState.returns({
|
||||
user: {isGuest: true}
|
||||
});
|
||||
|
||||
expectNavigate(mock, '/change-password');
|
||||
|
||||
state.enter(context);
|
||||
});
|
||||
});
|
||||
|
||||
describe('#resolve', () => {
|
||||
it('should call changePassword with payload', () => {
|
||||
const payload = {};
|
||||
|
||||
expectRun(
|
||||
mock,
|
||||
'changePassword',
|
||||
sinon.match.same(payload)
|
||||
).returns({then() {}});
|
||||
|
||||
state.resolve(context, payload);
|
||||
});
|
||||
|
||||
it('should transition to complete state on success', () => {
|
||||
const promise = Promise.resolve();
|
||||
|
||||
mock.expects('run').returns(promise);
|
||||
expectState(mock, CompleteState);
|
||||
|
||||
state.resolve(context);
|
||||
|
||||
return promise;
|
||||
});
|
||||
|
||||
it('should NOT transition to complete state on fail', () => {
|
||||
const promise = Promise.reject();
|
||||
|
||||
mock.expects('run').returns(promise);
|
||||
mock.expects('setState').never();
|
||||
|
||||
state.resolve(context);
|
||||
|
||||
return promise.catch(mock.verify.bind(mock));
|
||||
});
|
||||
});
|
||||
|
||||
describe('#reject', () => {
|
||||
it('should transition to complete state and mark that password should not be changed', () => {
|
||||
expectRun(
|
||||
mock,
|
||||
'updateUser',
|
||||
sinon.match({
|
||||
shouldChangePassword: false
|
||||
})
|
||||
);
|
||||
|
||||
expectState(mock, CompleteState);
|
||||
|
||||
state.reject(context);
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -3,7 +3,6 @@ import expect from 'unexpected';
|
||||
import CompleteState from 'services/authFlow/CompleteState';
|
||||
import LoginState from 'services/authFlow/LoginState';
|
||||
import ActivationState from 'services/authFlow/ActivationState';
|
||||
import ChangePasswordState from 'services/authFlow/ChangePasswordState';
|
||||
import AcceptRulesState from 'services/authFlow/AcceptRulesState';
|
||||
import FinishState from 'services/authFlow/FinishState';
|
||||
import PermissionsState from 'services/authFlow/PermissionsState';
|
||||
@@ -68,35 +67,6 @@ describe('CompleteState', () => {
|
||||
state.enter(context);
|
||||
});
|
||||
|
||||
it('should transition to change-password if shouldChangePassword', () => {
|
||||
context.getState.returns({
|
||||
user: {
|
||||
shouldChangePassword: true,
|
||||
isActive: true,
|
||||
isGuest: false
|
||||
},
|
||||
auth: {}
|
||||
});
|
||||
|
||||
expectState(mock, ChangePasswordState);
|
||||
|
||||
state.enter(context);
|
||||
});
|
||||
|
||||
it('should transition to activation with higher priority than shouldChangePassword', () => {
|
||||
context.getState.returns({
|
||||
user: {
|
||||
shouldChangePassword: true,
|
||||
isGuest: false
|
||||
},
|
||||
auth: {}
|
||||
});
|
||||
|
||||
expectState(mock, ActivationState);
|
||||
|
||||
state.enter(context);
|
||||
});
|
||||
|
||||
it('should transition to accept-rules if shouldAcceptRules', () => {
|
||||
context.getState.returns({
|
||||
user: {
|
||||
|
||||
Reference in New Issue
Block a user