Headless CMS and Content Managment Hub
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

36 lines
926 B

/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { UsersState } from '@app/features/administration/internal';
import { of } from 'rxjs';
import { IMock, Mock, Times } from 'typemoq';
import { UnsetUserGuard } from './unset-user.guard';
describe('UnsetUserGuard', () => {
let usersState: IMock<UsersState>;
let userGuard: UnsetUserGuard;
beforeEach(() => {
usersState = Mock.ofType<UsersState>();
userGuard = new UnsetUserGuard(usersState.object);
});
it('should unset user', () => {
usersState.setup(x => x.select(null))
.returns(() => of(null));
let result: boolean;
userGuard.canActivate().subscribe(x => {
result = x;
}).unsubscribe();
expect(result!).toBeTruthy();
usersState.verify(x => x.select(null), Times.once());
});
});