fix: address final review findings (order-notification watcher robustness)
Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user