test: Split test utilities to improve test times (#2622)

This commit is contained in:
Dermot Duffy
2026-07-26 16:29:53 -07:00
committed by GitHub
parent 8d44fcecf1
commit ad89aa9538
234 changed files with 2730 additions and 2516 deletions
+13 -10
View File
@@ -1,20 +1,23 @@
import { describe, expect, it, vi } from 'vitest';
import { getIntegrationManifest } from '../../../src/ha/integration';
import { integrationManifestSchema } from '../../../src/ha/integration/types';
import { homeAssistantWSRequest } from '../../../src/ha/ws-request.js';
import { createHASS } from '../../test-utils';
vi.mock('../../../src/ha/ws-request.js');
describe('getIntegrationManifest', () => {
it('should get integration manifest', async () => {
const hass = createHASS();
await getIntegrationManifest(hass, 'INTEGRATION');
expect(homeAssistantWSRequest).toHaveBeenCalledWith(
hass,
integrationManifestSchema,
{ type: 'manifest/get', integration: 'INTEGRATION' },
);
vi.mocked(hass.callWS).mockResolvedValue({
domain: 'INTEGRATION',
version: '1.0',
});
expect(await getIntegrationManifest(hass, 'INTEGRATION')).toEqual({
domain: 'INTEGRATION',
version: '1.0',
});
expect(hass.callWS).toHaveBeenCalledWith({
type: 'manifest/get',
integration: 'INTEGRATION',
});
});
});