Skip to content

Commit 1636ccf

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

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

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

+16-2
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,6 @@ describe('CoursesCardListComponent', () => {
3737
});
3838

3939

40-
4140
it('should display the course list', () => {
4241

4342
component.courses = setupCourses();
@@ -57,7 +56,22 @@ describe('CoursesCardListComponent', () => {
5756

5857
it('should display the first course', () => {
5958

60-
pending();
59+
component.courses = setupCourses();
60+
61+
fixture.detectChanges();
62+
63+
const course = component.courses[0];
64+
65+
const card = el.query(By.css(".course-card:first-child")),
66+
title = card.query(By.css("mat-card-title")),
67+
image = card.query(By.css("img"));
68+
69+
expect(card).toBeTruthy("Could not find course card");
70+
71+
expect(title.nativeElement.textContent).toBe(course.titles.description);
72+
73+
expect(image.nativeElement.src).toBe(course.iconUrl);
74+
6175

6276
});
6377

0 commit comments

Comments
 (0)