Skip to content

Commit 109a3e7

Browse files
author
Your Name
committed
Angular Testing Course
1 parent df48d51 commit 109a3e7

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

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

+14-2
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ describe('CoursesCardListComponent', () => {
1414

1515
let component: CoursesCardListComponent;
1616
let fixture: ComponentFixture<CoursesCardListComponent>;
17+
let el: DebugElement;
1718

1819
beforeEach(async(() => {
1920
TestBed.configureTestingModule({
@@ -24,25 +25,36 @@ describe('CoursesCardListComponent', () => {
2425

2526
fixture = TestBed.createComponent(CoursesCardListComponent);
2627
component = fixture.componentInstance;
28+
el = fixture.debugElement;
2729

2830
});
2931
}));
3032

31-
3233
it('should create the component', () => {
3334

3435
expect(component).toBeTruthy();
3536

3637
});
3738

3839

40+
3941
it('should display the course list', () => {
4042

41-
pending();
43+
component.courses = setupCourses();
44+
45+
fixture.detectChanges();
46+
47+
const cards = el.queryAll(By.css(".course-card"));
48+
49+
expect(cards).toBeTruthy("Could not find cards");
50+
expect(cards.length).toBe(12, "Unexpected number of courses");
4251

4352
});
4453

4554

55+
56+
57+
4658
it('should display the first course', () => {
4759

4860
pending();

0 commit comments

Comments
 (0)