feat: Add event-based automation triggers (#2537)

This commit is contained in:
Dermot Duffy
2026-06-30 17:45:13 -07:00
committed by dermotduffy
parent b701366762
commit a31816c168
109 changed files with 4607 additions and 1623 deletions
+34
View File
@@ -0,0 +1,34 @@
import { STATE_RUNNING } from 'home-assistant-js-websocket';
import { describe, expect, it } from 'vitest';
import { isHassReady } from '../../src/ha/is-hass-ready';
import { createHASS } from '../test-utils';
describe('isHassReady', () => {
it('should return false for null', () => {
expect(isHassReady(null)).toBe(false);
});
it('should return false for undefined', () => {
expect(isHassReady(undefined)).toBe(false);
});
it('should return false when disconnected', () => {
const hass = createHASS();
hass.connected = false;
expect(isHassReady(hass)).toBe(false);
});
it('should return false when integrations are still loading', () => {
const hass = createHASS();
hass.connected = true;
hass.config.state = 'NOT_RUNNING';
expect(isHassReady(hass)).toBe(false);
});
it('should return true when connected and running', () => {
const hass = createHASS();
hass.connected = true;
hass.config.state = STATE_RUNNING;
expect(isHassReady(hass)).toBe(true);
});
});