chore: Enforce a few house rules via eslint (#2539)

This commit is contained in:
Dermot Duffy
2026-06-30 17:45:13 -07:00
committed by dermotduffy
parent 5572ec728e
commit 921d45e577
100 changed files with 479 additions and 295 deletions
@@ -68,6 +68,28 @@ describe('IssueStateManager', () => {
expect(mockLegacyResource.detectStatic).toBeCalledWith(hass);
expect(mockMediaLoad.detectStatic).toBeCalledWith(hass);
});
it('should isolate a failing issue and continue detecting the rest', async () => {
const spy = vi.spyOn(console, 'warn').mockReturnValue();
assert(mockConfigUpgrade.detectStatic);
assert(mockLegacyResource.detectStatic);
assert(mockMediaLoad.detectStatic);
vi.mocked(mockConfigUpgrade.detectStatic).mockRejectedValue(new Error('boom'));
// A second failure, a non-Error rejection, is isolated and logged too.
vi.mocked(mockLegacyResource.detectStatic).mockRejectedValue('bad');
const manager = createManager();
const hass = createHASS();
await expect(manager.detectStatic(hass)).resolves.toBeUndefined();
// Detection continued to the final issue despite the two earlier failures.
expect(mockMediaLoad.detectStatic).toBeCalledWith(hass);
expect(spy).toBeCalledTimes(2);
spy.mockRestore();
});
});
describe('trigger', () => {