test: Split test utilities to improve test times (#2622)
This commit is contained in:
@@ -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',
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user