mirror of https://github.com/Squidex/squidex.git
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.
38 lines
865 B
38 lines
865 B
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { of } from 'rxjs';
|
|
import { IMock, Mock, Times } from 'typemoq';
|
|
|
|
import { AppsState } from '@app/shared';
|
|
|
|
import { LoadAppsGuard } from './load-apps.guard';
|
|
|
|
describe('LoadAppsGuard', () => {
|
|
let appsState: IMock<AppsState>;
|
|
let appGuard: LoadAppsGuard;
|
|
|
|
beforeEach(() => {
|
|
appsState = Mock.ofType<AppsState>();
|
|
appGuard = new LoadAppsGuard(appsState.object);
|
|
});
|
|
|
|
it('should load apps', () => {
|
|
appsState.setup(x => x.load())
|
|
.returns(() => of(null));
|
|
|
|
let result = false;
|
|
|
|
appGuard.canActivate().subscribe(value => {
|
|
result = value;
|
|
});
|
|
|
|
expect(result).toBeTruthy();
|
|
|
|
appsState.verify(x => x.load(), Times.once());
|
|
});
|
|
});
|