blob: 855ea4a1233430c2815efe3f886c0209a86b7fc9 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { UserLogoutComponent } from './user-logout.component';
import { InternalUserService } from '../internal-user-service/internal-user.service';
describe('UserLogoutComponent', () => {
let component: UserLogoutComponent;
let fixture: ComponentFixture<UserLogoutComponent>;
let mockInternalUserService: jasmine.SpyObj<InternalUserService>;
beforeEach(async(() => {
mockInternalUserService = jasmine.createSpyObj('InternalUserService', ['logout']);
TestBed.configureTestingModule({
declarations: [UserLogoutComponent],
providers: [{ provide: InternalUserService, useValue: mockInternalUserService }]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(UserLogoutComponent);
component = fixture.componentInstance;
});
it('should create', () => {
expect(component).toBeTruthy();
});
it('should logout on init', () => {
fixture.detectChanges();
expect(mockInternalUserService.logout).toHaveBeenCalled();
});
});
|