From ee6d0a3c3e0d314c12545e9968b06bdc50351602 Mon Sep 17 00:00:00 2001 From: Mathis Hofer Date: Wed, 16 Oct 2024 10:12:03 +0200 Subject: [PATCH] WIP: fix tests --- ...ier-grades-course-header.component.spec.ts | 20 ++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/src/app/shared/components/student-dossier/dossier-grades-course-header/dossier-grades-course-header.component.spec.ts b/src/app/shared/components/student-dossier/dossier-grades-course-header/dossier-grades-course-header.component.spec.ts index 1339de1c9..b328b2a18 100644 --- a/src/app/shared/components/student-dossier/dossier-grades-course-header/dossier-grades-course-header.component.spec.ts +++ b/src/app/shared/components/student-dossier/dossier-grades-course-header/dossier-grades-course-header.component.spec.ts @@ -33,7 +33,9 @@ describe("DossierGradesCourseHeaderComponent", () => { component.designation = "course 1"; fixture.detectChanges(); - expect(debugElement.nativeElement.textContent).toBe("course 1"); + expect(debugElement.nativeElement.textContent.replace("\n", "")).toBe( + "course 1", + ); }); it("should show designation and grade", () => { @@ -44,7 +46,9 @@ describe("DossierGradesCourseHeaderComponent", () => { ]); fixture.detectChanges(); - expect(debugElement.nativeElement.textContent).toBe("course 2 (5.5)"); + expect(debugElement.nativeElement.textContent.replace("\n", "")).toBe( + "course 2 (5.5)", + ); }); it("should show designation and average", () => { @@ -52,7 +56,9 @@ describe("DossierGradesCourseHeaderComponent", () => { component.average = 5.2555; fixture.detectChanges(); - expect(debugElement.nativeElement.textContent).toBe("course 3 (5.256)"); + expect(debugElement.nativeElement.textContent.replace("\n", "")).toBe( + "course 3 (5.256)", + ); }); it("should show designation and only grade if both average and grade are set", () => { @@ -64,7 +70,9 @@ describe("DossierGradesCourseHeaderComponent", () => { ]); fixture.detectChanges(); - expect(debugElement.nativeElement.textContent).toBe("course 4 (5.5)"); + expect(debugElement.nativeElement.textContent.replace("\n", "")).toBe( + "course 4 (5.5)", + ); }); it("should only show designation if average is 0", () => { @@ -72,6 +80,8 @@ describe("DossierGradesCourseHeaderComponent", () => { component.average = 0; fixture.detectChanges(); - expect(debugElement.nativeElement.textContent).toBe("course 5"); + expect(debugElement.nativeElement.textContent.replace("\n", "")).toBe( + "course 5", + ); }); });