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.
 
 
 
 
 

32 lines
885 B

/*
* Squidex Headless CMS
*
* @license
* Copyright (c) Squidex UG (haftungsbeschränkt). All rights reserved.
*/
import { SchemasState } from '@app/shared';
import { firstValueFrom, of } from 'rxjs';
import { IMock, Mock, Times } from 'typemoq';
import { LoadSchemasGuard } from './load-schemas.guard';
describe('LoadSchemasGuard', () => {
let schemasState: IMock<SchemasState>;
let schemaGuard: LoadSchemasGuard;
beforeEach(() => {
schemasState = Mock.ofType<SchemasState>();
schemaGuard = new LoadSchemasGuard(schemasState.object);
});
it('should load schemas', async () => {
schemasState.setup(x => x.load())
.returns(() => of(null));
const result = await firstValueFrom(schemaGuard.canActivate());
expect(result).toBeTruthy();
schemasState.verify(x => x.load(), Times.once());
});
});