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.
 
 
 
 
 

38 lines
950 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 { LanguagesState } from '@app/shared';
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());
});
});