-
Notifications
You must be signed in to change notification settings - Fork 30
/
Copy pathapp.component.spec.ts
40 lines (34 loc) · 1.06 KB
/
app.component.spec.ts
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
36
37
38
39
40
import { TestBed, waitForAsync } from '@angular/core/testing';
import { Router } from '@angular/router';
import { of } from 'rxjs';
import { AppComponent } from './app.component';
import { LanguageService } from './services/language/language.service';
import { ExplorerService } from './services/explorer/explorer.service';
class MockRouter {
events = of(null);
}
class MockLanguageService {
initialize() {}
}
class MockExplorerService {
initialize() {}
}
describe('AppComponent', () => {
beforeEach(waitForAsync(() => {
TestBed.configureTestingModule({
declarations: [
AppComponent
],
providers: [
{ provide: Router, useClass: MockRouter },
{ provide: LanguageService, useClass: MockLanguageService },
{ provide: ExplorerService, useClass: MockExplorerService },
]
}).compileComponents();
}));
it('should create the app', waitForAsync(() => {
const fixture = TestBed.createComponent(AppComponent);
const app = fixture.debugElement.componentInstance;
expect(app).toBeTruthy();
}));
});