fix: Clear stale media unavailable errors when a camera recovers (#2627)

- Closes: #2576
This commit is contained in:
Dermot Duffy
2026-07-28 21:21:50 -07:00
committed by GitHub
parent 231e3087b7
commit 15b08db3e8
49 changed files with 1128 additions and 229 deletions
@@ -219,6 +219,22 @@ describe('EntityAvailabilityDetector', () => {
expect(detector.getVerdict()).toEqual({ state: 'unknown' });
});
it('should re-check the entity when reset', () => {
// always_error makes the re-check produce a verdict immediately rather than
// waiting out the grace window.
const { detector, setEntityState } = setup({ alwaysError: true });
detector.subscribe();
// An entity that is already unavailable never fires a state change, so
// resetting must read it rather than wait to be told.
setEntityState('unavailable');
detector.reset();
expect(detector.getVerdict()).toEqual(
expect.objectContaining({ state: 'not_live', authority: 'hard' }),
);
});
it('should do nothing on reset before subscribe', () => {
const { detector, stateWatcher } = setup();