Skip to content

Commit 8c7667e

Browse files
author
Your Name
committed
Angular Testing Course
1 parent 43325e6 commit 8c7667e

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

src/app/courses/home/home.component.spec.ts

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ describe('HomeComponent', () => {
100100
});
101101

102102

103-
it("should display advanced courses when tab clicked", () => {
103+
it("should display advanced courses when tab clicked", (done: DoneFn) => {
104104

105105
coursesService.findAllCourses.and.returnValue(of(setupCourses()));
106106

@@ -112,11 +112,17 @@ describe('HomeComponent', () => {
112112

113113
fixture.detectChanges();
114114

115-
const cardTitles = el.queryAll(By.css('.mat-card-title'));
115+
setTimeout(() => {
116116

117-
expect(cardTitles.length).toBeGreaterThan(0,"Could not find card titles");
117+
const cardTitles = el.queryAll(By.css('.mat-card-title'));
118118

119-
expect(cardTitles[0].nativeElement.textContent).toContain("Angular Security Course");
119+
expect(cardTitles.length).toBeGreaterThan(0,"Could not find card titles");
120+
121+
expect(cardTitles[0].nativeElement.textContent).toContain("Angular Security Course");
122+
123+
done();
124+
125+
}, 500);
120126

121127
});
122128

0 commit comments

Comments
 (0)