mirror of
https://github.com/elyby/accounts-frontend.git
synced 2025-05-31 14:11:58 +05:30
Убрал повторный запрос на complete, когда acceptRequired
This commit is contained in:
@@ -112,6 +112,25 @@ describe('CompleteState', () => {
|
||||
|
||||
state.enter(context);
|
||||
});
|
||||
|
||||
it('should transition to permissions state if acceptRequired', () => {
|
||||
context.getState.returns({
|
||||
user: {
|
||||
isActive: true,
|
||||
isGuest: false
|
||||
},
|
||||
auth: {
|
||||
oauth: {
|
||||
clientId: 'ely.by',
|
||||
acceptRequired: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
expectState(mock, PermissionsState);
|
||||
|
||||
state.enter(context);
|
||||
});
|
||||
});
|
||||
|
||||
describe('oAuthComplete', () => {
|
||||
@@ -236,7 +255,7 @@ describe('CompleteState', () => {
|
||||
it('should transition to permissions state if rejected with acceptRequired', () => {
|
||||
return testOAuth('reject', {acceptRequired: true}, PermissionsState);
|
||||
});
|
||||
})
|
||||
});
|
||||
|
||||
describe('permissions accept', () => {
|
||||
it('should set flags, when user accepted permissions', () => {
|
||||
@@ -301,5 +320,61 @@ describe('CompleteState', () => {
|
||||
|
||||
state.enter(context);
|
||||
});
|
||||
|
||||
it('should run oAuthComplete passing accept: true, while acceptRequired: true', () => {
|
||||
// acceptRequired may block user accept/decline actions, so we need
|
||||
// to check that they are accessible
|
||||
const expected = {accept: true};
|
||||
|
||||
state = new CompleteState(expected);
|
||||
context.getState.returns({
|
||||
user: {
|
||||
isActive: true,
|
||||
isGuest: false
|
||||
},
|
||||
auth: {
|
||||
oauth: {
|
||||
clientId: 'ely.by',
|
||||
acceptRequired: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
expectRun(
|
||||
mock,
|
||||
'oAuthComplete',
|
||||
sinon.match(expected)
|
||||
).returns({then() {}});
|
||||
|
||||
state.enter(context);
|
||||
});
|
||||
|
||||
it('should run oAuthComplete passing accept: false, while acceptRequired: true', () => {
|
||||
// acceptRequired may block user accept/decline actions, so we need
|
||||
// to check that they are accessible
|
||||
const expected = {accept: false};
|
||||
|
||||
state = new CompleteState(expected);
|
||||
context.getState.returns({
|
||||
user: {
|
||||
isActive: true,
|
||||
isGuest: false
|
||||
},
|
||||
auth: {
|
||||
oauth: {
|
||||
clientId: 'ely.by',
|
||||
acceptRequired: true
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
expectRun(
|
||||
mock,
|
||||
'oAuthComplete',
|
||||
sinon.match(expected)
|
||||
).returns({then() {}});
|
||||
|
||||
state.enter(context);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user