|
| 1 | + |
| 2 | +import { async, ComponentFixture, TestBed } from '@angular/core/testing'; |
| 3 | + |
| 4 | +import { CourseComponent } from './course.component'; |
| 5 | +import {CoursesModule} from '../courses.module'; |
| 6 | +import {CoursesService} from '../services/courses.service'; |
| 7 | +import {NoopAnimationsModule} from '@angular/platform-browser/animations'; |
| 8 | +import {ActivatedRoute} from '@angular/router'; |
| 9 | +import {COURSES} from '../../../../server/db-data'; |
| 10 | +import {of} from 'rxjs'; |
| 11 | +import {setupCourses} from '../common/setup-test-data'; |
| 12 | + |
| 13 | +describe('CourseComponent', () => { |
| 14 | + let component: CourseComponent; |
| 15 | + let fixture: ComponentFixture<CourseComponent>; |
| 16 | + |
| 17 | + beforeEach(async(() => { |
| 18 | + |
| 19 | + const courseServicesSpy = jasmine.createSpyObj('CoursesService', ['findLessons']); |
| 20 | + |
| 21 | + courseServicesSpy.findLessons.and.returnValue(of()); |
| 22 | + |
| 23 | + const mockActivatedRoute = { |
| 24 | + snapshot: { |
| 25 | + data: { |
| 26 | + course: COURSES[12] |
| 27 | + } |
| 28 | + } |
| 29 | + }; |
| 30 | + |
| 31 | + TestBed.configureTestingModule({ |
| 32 | + imports: [ |
| 33 | + CoursesModule, |
| 34 | + NoopAnimationsModule |
| 35 | + ], |
| 36 | + providers: [ |
| 37 | + {provide: ActivatedRoute, useValue: mockActivatedRoute}, |
| 38 | + {provide: CoursesService, useValue: courseServicesSpy}, |
| 39 | + |
| 40 | + ] |
| 41 | + }).compileComponents(); |
| 42 | + |
| 43 | + |
| 44 | + })); |
| 45 | + |
| 46 | + beforeEach(() => { |
| 47 | + fixture = TestBed.createComponent(CourseComponent); |
| 48 | + component = fixture.componentInstance; |
| 49 | + fixture.detectChanges(); |
| 50 | + }); |
| 51 | + |
| 52 | + it('should create the component', () => { |
| 53 | + expect(component).toBeTruthy(); |
| 54 | + }); |
| 55 | + |
| 56 | + it('should display the course data', () => { |
| 57 | + pending(); |
| 58 | + }); |
| 59 | + |
| 60 | + it('should display the course lessons', () => { |
| 61 | + pending(); |
| 62 | + }); |
| 63 | + |
| 64 | + it('should load the next page of lessons', () => { |
| 65 | + pending(); |
| 66 | + }); |
| 67 | + |
| 68 | + it('should search for lessons', () => { |
| 69 | + pending(); |
| 70 | + }); |
| 71 | + |
| 72 | + |
| 73 | +}); |
0 commit comments