Skip to content

Commit 4cf47ed

Browse files
committed
Update courses-card-list.component.spec.ts
1 parent b905d70 commit 4cf47ed

File tree

1 file changed

+30
-29
lines changed

1 file changed

+30
-29
lines changed

src/app/courses/courses-card-list/courses-card-list.component.spec.ts

Lines changed: 30 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,53 @@
1-
import { DebugElement } from '@angular/core';
2-
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
3-
import { By } from '@angular/platform-browser';
4-
import { COURSES } from '../../../../server/db-data';
5-
import { setupCourses } from '../common/setup-test-data';
6-
import { CoursesModule } from '../courses.module';
7-
import { sortCoursesBySeqNo } from '../home/sort-course-by-seq';
8-
import { Course } from '../model/course';
9-
import { CoursesCardListComponent } from './courses-card-list.component';
1+
import { DebugElement } from "@angular/core";
2+
import { async, ComponentFixture, TestBed } from "@angular/core/testing";
3+
import { By } from "@angular/platform-browser";
4+
import { COURSES } from "../../../../server/db-data";
5+
import { setupCourses } from "../common/setup-test-data";
6+
import { CoursesModule } from "../courses.module";
7+
import { sortCoursesBySeqNo } from "../home/sort-course-by-seq";
8+
import { Course } from "../model/course";
9+
import { CoursesCardListComponent } from "./courses-card-list.component";
1010

11+
describe("CoursesCardListComponent", () => {
12+
// series of variables will be used throughout the test
1113

14+
let component: CoursesCardListComponent;
1215

13-
14-
describe('CoursesCardListComponent', () => {
15-
16+
// test uility type for obtainng/debugging the compoent
17+
// will bring lots of feature which will be needed to test the component
18+
let fixture: ComponentFixture<CoursesCardListComponent>;
1619

1720
//init our test
18-
beforeEach(() => {
19-
21+
// async is going to wait for this asynchornou operation triggered by the below code and async is going to wait for 5 sec
22+
beforeEach(async () => {
2023
//setting up testing module and provide the dependencies
2124

2225
TestBed.configureTestingModule({
26+
imports: [CoursesModule],
27+
})
28+
.compileComponents()
29+
.then(() => {
30+
//setup of our test
2331

24-
imports: [CoursesModule]
32+
fixture = TestBed.createComponent(CoursesCardListComponent);
2533

34+
component = fixture.componentInstance;
35+
});
36+
});
2637

27-
})
28-
})
2938
it("should create the component", () => {
39+
// pending();
3040

31-
pending();
41+
expect(component).toBeTruthy();
3242

43+
console.log(component);
3344
});
3445

35-
3646
it("should display the course list", () => {
37-
3847
pending();
39-
4048
});
4149

42-
4350
it("should display the first course", () => {
44-
45-
pending();
46-
51+
pending();
4752
});
48-
49-
5053
});
51-
52-

0 commit comments

Comments
 (0)