Add comprehensive Home Assistant WebSocket and API tests
- Created detailed test suite for Home Assistant WebSocket client - Implemented tests for WebSocket connection, authentication, and error handling - Added comprehensive test coverage for HassInstanceImpl API methods - Mocked WebSocket and fetch to simulate various connection scenarios - Covered authentication, state retrieval, service calls, and environment configuration - Improved test infrastructure for Home Assistant integration
This commit is contained in:
@@ -5,29 +5,30 @@ module.exports = {
|
||||
extensionsToTreatAsEsm: ['.ts'],
|
||||
moduleNameMapper: {
|
||||
'^(\\.{1,2}/.*)\\.js$': '$1',
|
||||
'#(.*)': '<rootDir>/node_modules/$1',
|
||||
'^(\\.{1,2}/.*)\\.ts$': '$1',
|
||||
'^chalk$': 'chalk',
|
||||
'#ansi-styles': 'ansi-styles',
|
||||
'#supports-color': 'supports-color'
|
||||
'^chalk$': '<rootDir>/node_modules/chalk/source/index.js',
|
||||
'#ansi-styles': '<rootDir>/node_modules/ansi-styles/index.js',
|
||||
'#supports-color': '<rootDir>/node_modules/supports-color/index.js'
|
||||
},
|
||||
transform: {
|
||||
'^.+\\.tsx?$': [
|
||||
'ts-jest',
|
||||
{
|
||||
useESM: true,
|
||||
tsconfig: 'tsconfig.json'
|
||||
},
|
||||
],
|
||||
},
|
||||
transformIgnorePatterns: [
|
||||
'node_modules/(?!(@digital-alchemy|chalk|ansi-styles|supports-color)/)'
|
||||
'node_modules/(?!(@digital-alchemy|chalk|ansi-styles|supports-color)/.*)'
|
||||
],
|
||||
resolver: '<rootDir>/jest-resolver.cjs',
|
||||
setupFilesAfterEnv: ['<rootDir>/jest.setup.ts'],
|
||||
testMatch: [
|
||||
'**/__tests__/helpers.test.ts',
|
||||
'**/__tests__/schemas/devices.test.ts',
|
||||
'**/__tests__/context/index.test.ts'
|
||||
'**/__tests__/context/index.test.ts',
|
||||
'**/__tests__/hass/index.test.ts'
|
||||
],
|
||||
globals: {
|
||||
'ts-jest': {
|
||||
|
||||
Reference in New Issue
Block a user