Skip to content

Commit

Permalink
WIP: fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
hupf committed Oct 16, 2024
1 parent 90e3968 commit ee6d0a3
Showing 1 changed file with 15 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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", () => {
Expand All @@ -44,15 +46,19 @@ 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", () => {
component.designation = "course 3";
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", () => {
Expand All @@ -64,14 +70,18 @@ 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", () => {
component.designation = "course 5";
component.average = 0;

fixture.detectChanges();
expect(debugElement.nativeElement.textContent).toBe("course 5");
expect(debugElement.nativeElement.textContent.replace("\n", "")).toBe(
"course 5",
);
});
});

0 comments on commit ee6d0a3

Please sign in to comment.