fix: address final review findings (order-notification watcher robustness)

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
sdarbinyan
2026-08-15 04:18:20 +04:00
parent 9ccd807a55
commit 1032891d26
8 changed files with 127 additions and 15 deletions

View File

@@ -30,6 +30,7 @@ describe('AdminLayoutComponent notifications bell', () => {
recentOrders: ReturnType<typeof signal<AdminOrder[]>>;
unreadCount: ReturnType<typeof signal<number>>;
start: jasmine.Spy;
stop: jasmine.Spy;
markAllSeen: jasmine.Spy;
};
@@ -38,6 +39,7 @@ describe('AdminLayoutComponent notifications bell', () => {
recentOrders: signal<AdminOrder[]>([makeOrder('o1', '1001')]),
unreadCount: signal(1),
start: jasmine.createSpy('start'),
stop: jasmine.createSpy('stop'),
markAllSeen: jasmine.createSpy('markAllSeen'),
};
@@ -73,4 +75,11 @@ describe('AdminLayoutComponent notifications bell', () => {
expect(component.notificationsOpen()).toBe(false);
expect(watcherStub.markAllSeen).toHaveBeenCalledTimes(1);
});
it('stops the watcher when the component is destroyed', () => {
const fixture = TestBed.createComponent(AdminLayoutComponent);
fixture.detectChanges();
fixture.destroy();
expect(watcherStub.stop).toHaveBeenCalledTimes(1);
});
});