This repository has been archived on 2021-08-17. You can view files and clone it, but cannot push or open issues or pull requests.
TaskBoard/test/app/shared/auth/auth.guard.spec.ts
2020-05-14 13:12:47 -04:00

41 lines
854 B
TypeScript

import { TestBed, getTestBed } from '@angular/core/testing'
import { AuthGuard } from 'src/app/shared/auth/auth.guard';
import { AuthService } from 'src/app/shared/services';
import { AuthServiceMock } from '../../mocks';
describe('AuthGuard', () => {
let injector: TestBed;
let service: AuthGuard;
beforeEach(() => {
TestBed.configureTestingModule({
imports: [],
providers: [
AuthGuard,
{ provide: AuthService, useClass: AuthServiceMock }
]
});
injector = getTestBed();
service = injector.get(AuthGuard);
});
it('should be created', () => {
expect(service).toBeTruthy();
});
it('implements CanActivate', () => {
let actual = false;
service.canActivate(null, { url: '' } as any)
.subscribe(value => actual = value);
expect(actual).toEqual(true);
});
});