Remove change password auth panel

This commit is contained in:
SleepWalker
2016-08-02 22:13:11 +03:00
parent cb1a4b7d55
commit 6dcf985936
24 changed files with 10 additions and 303 deletions

View File

@@ -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,

View File

@@ -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);
});
});
});

View File

@@ -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: {