Skip to content

Commit ed436a4

Browse files
committed
test(book-list): add basic test-setup for book-list
1 parent 853dcb1 commit ed436a4

File tree

1 file changed

+39
-0
lines changed

1 file changed

+39
-0
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import { RouterTestingModule } from '@angular/router/testing';
2+
import { BookStaticAsyncDataService } from './../shared/book-static-async-data.service';
3+
import { BookDataService } from '../shared/book-data.service';
4+
import { ComponentFixture, TestBed } from '@angular/core/testing';
5+
6+
import { BookListComponent } from './book-list.component';
7+
import { DebugElement } from '@angular/core';
8+
9+
10+
describe('BookListComponent', () => {
11+
let component: BookListComponent;
12+
let fixture: ComponentFixture<BookListComponent>;
13+
let compiled;
14+
15+
beforeEach(() => {
16+
TestBed.configureTestingModule({
17+
declarations: [
18+
BookListComponent
19+
],
20+
imports: [
21+
RouterTestingModule.withRoutes([])
22+
],
23+
providers: [{ provide: BookDataService, useClass: BookStaticAsyncDataService }]
24+
})
25+
.compileComponents();
26+
});
27+
28+
beforeEach(() => {
29+
fixture = TestBed.createComponent(BookListComponent);
30+
component = fixture.componentInstance;
31+
fixture.detectChanges();
32+
compiled = fixture.debugElement.nativeElement;
33+
});
34+
35+
it('should be created', () => {
36+
expect(component).toBeTruthy();
37+
});
38+
39+
});

0 commit comments

Comments
 (0)