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.
36 lines
948 B
36 lines
948 B
/*
|
|
* Squidex Headless CMS
|
|
*
|
|
* @license
|
|
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
|
|
*/
|
|
|
|
import { LanguagesState } from '@app/shared';
|
|
import { of } from 'rxjs';
|
|
import { IMock, Mock, Times } from 'typemoq';
|
|
import { LoadLanguagesGuard } from './load-languages.guard';
|
|
|
|
describe('LoadLanguagesGuard', () => {
|
|
let languagesState: IMock<LanguagesState>;
|
|
let languageGuard: LoadLanguagesGuard;
|
|
|
|
beforeEach(() => {
|
|
languagesState = Mock.ofType<LanguagesState>();
|
|
languageGuard = new LoadLanguagesGuard(languagesState.object);
|
|
});
|
|
|
|
it('should load languages', () => {
|
|
languagesState.setup(x => x.load())
|
|
.returns(() => of(null));
|
|
|
|
let result = false;
|
|
|
|
languageGuard.canActivate().subscribe(value => {
|
|
result = value;
|
|
});
|
|
|
|
expect(result).toBeTruthy();
|
|
|
|
languagesState.verify(x => x.load(), Times.once());
|
|
});
|
|
});
|