From 0566b501a3183aff740c926f19cb465b6c737b92 Mon Sep 17 00:00:00 2001 From: Sebastian Leidig Date: Mon, 23 Dec 2024 17:38:02 +0100 Subject: [PATCH] fix outputs and tests --- .../notification-item.component.html | 4 ++-- .../notification-item.component.spec.ts | 12 +++++++++++- .../notification/notification.component.spec.ts | 16 +++++++++++++++- 3 files changed, 28 insertions(+), 4 deletions(-) diff --git a/src/app/features/notification/notification-item/notification-item.component.html b/src/app/features/notification/notification-item/notification-item.component.html index e1d40a217b..98f2f71275 100644 --- a/src/app/features/notification/notification-item/notification-item.component.html +++ b/src/app/features/notification/notification-item/notification-item.component.html @@ -8,9 +8,9 @@
- {{ notification.created.at | notificationTime }} + {{ notification.created?.at | notificationTime }}
diff --git a/src/app/features/notification/notification-item/notification-item.component.spec.ts b/src/app/features/notification/notification-item/notification-item.component.spec.ts index defac9f904..875a81c03c 100644 --- a/src/app/features/notification/notification-item/notification-item.component.spec.ts +++ b/src/app/features/notification/notification-item/notification-item.component.spec.ts @@ -1,6 +1,9 @@ import { ComponentFixture, TestBed } from "@angular/core/testing"; import { NotificationItemComponent } from "./notification-item.component"; +import { NotificationEvent } from "../model/notification-event"; +import { FontAwesomeTestingModule } from "@fortawesome/angular-fontawesome/testing"; +import { NoopAnimationsModule } from "@angular/platform-browser/animations"; describe("NotificationItemComponent", () => { let component: NotificationItemComponent; @@ -8,11 +11,18 @@ describe("NotificationItemComponent", () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [NotificationItemComponent], + imports: [ + NotificationItemComponent, + FontAwesomeTestingModule, + NoopAnimationsModule, + ], }).compileComponents(); fixture = TestBed.createComponent(NotificationItemComponent); component = fixture.componentInstance; + + component.notification = new NotificationEvent(); + fixture.detectChanges(); }); diff --git a/src/app/features/notification/notification.component.spec.ts b/src/app/features/notification/notification.component.spec.ts index 9919477d65..404b5c3f5a 100644 --- a/src/app/features/notification/notification.component.spec.ts +++ b/src/app/features/notification/notification.component.spec.ts @@ -1,6 +1,12 @@ import { ComponentFixture, TestBed } from "@angular/core/testing"; import { NotificationComponent } from "./notification.component"; +import { EntityMapperService } from "../../core/entity/entity-mapper/entity-mapper.service"; +import { mockEntityMapper } from "../../core/entity/entity-mapper/mock-entity-mapper-service"; +import { SessionSubject } from "../../core/session/auth/session-info"; +import { of } from "rxjs"; +import { FontAwesomeTestingModule } from "@fortawesome/angular-fontawesome/testing"; +import { NoopAnimationsModule } from "@angular/platform-browser/animations"; describe("NotificationComponent", () => { let component: NotificationComponent; @@ -8,7 +14,15 @@ describe("NotificationComponent", () => { beforeEach(async () => { await TestBed.configureTestingModule({ - imports: [NotificationComponent], + imports: [ + NotificationComponent, + FontAwesomeTestingModule, + NoopAnimationsModule, + ], + providers: [ + { provide: EntityMapperService, useValue: mockEntityMapper() }, + { provide: SessionSubject, useValue: of(null) }, + ], }).compileComponents(); fixture = TestBed.createComponent(NotificationComponent);