UNPKG

homebridge-tsvesync

Version:

Homebridge plugin for VeSync devices including Levoit air purifiers, humidifiers, and Etekcity smart outlets

149 lines 4.2 kB
/// <reference types="jest" /> import { Logger } from 'homebridge'; import { PluginLogger } from '../../utils/logger'; import { RetryManager } from '../../utils/retry'; import { VeSyncOutlet } from '../../types/device.types'; import { VeSync } from 'tsvesync'; import { VeSyncSwitch } from '../../types/device.types'; import { VeSyncBulb } from '../../types/device.types'; import { VeSyncFan } from '../../types/device.types'; /** * Creates a mock Logger instance for testing */ export declare const createMockLogger: () => jest.Mocked<Logger>; /** * Creates a mock PluginLogger instance for testing */ export declare const createMockPluginLogger: (log?: Logger) => jest.Mocked<PluginLogger>; /** * Creates a mock RetryManager instance for testing */ export declare const createMockRetryManager: () => jest.Mocked<RetryManager>; /** * Creates a mock service instance for testing */ export declare const createMockService: () => { getCharacteristic: jest.Mock<any, any, any>; setCharacteristic: jest.Mock<any, any, any>; }; /** * Creates a mock info service instance for testing */ export declare const createMockInfoService: () => { setCharacteristic: jest.Mock<any, any, any>; }; /** * Type for mock device configuration */ export interface MockDeviceConfig { deviceName?: string; uuid?: string; deviceType?: string; getDetails?: jest.Mock; } /** * Creates a mock device instance for testing */ export declare const createMockDevice: (config?: MockDeviceConfig) => { deviceName: string; uuid: string; deviceType: string; getDetails: jest.Mock<any, any, any>; }; /** * Waits for all promises in the queue to resolve */ export declare const flushPromises: () => Promise<unknown>; /** * Helper to run async tests with proper timeout and error handling */ export declare const runAsyncTest: (testFn: () => Promise<void>, timeout?: number) => Promise<void>; /** * Simulates a network delay */ export declare const simulateNetworkDelay: (ms?: number) => Promise<void>; /** * Type for mock outlet configuration */ export interface MockOutletConfig { deviceName?: string; deviceType?: string; cid?: string; uuid?: string; power?: number; voltage?: number; energy?: number; current?: number; } /** * Creates a mock outlet instance for testing */ export declare const createMockOutlet: (config?: MockOutletConfig) => jest.Mocked<VeSyncOutlet>; /** * Creates a mock VeSync client for testing */ export declare const createMockVeSync: () => jest.Mocked<VeSync>; /** * Type for mock switch configuration */ export interface MockSwitchConfig { deviceName?: string; deviceType?: string; cid?: string; uuid?: string; power?: boolean; } /** * Creates a mock switch instance for testing */ export declare const createMockSwitch: (config?: MockSwitchConfig) => jest.Mocked<VeSyncSwitch>; export interface MockLightOptions { deviceName: string; deviceType: string; cid: string; uuid: string; power?: boolean; brightness?: number; colorTemp?: number; hue?: number; saturation?: number; subDeviceNo?: number; isSubDevice?: boolean; } export declare function createMockLight(options: MockLightOptions): VeSyncBulb; /** * Type for mock fan configuration */ export interface MockFanConfig { deviceName?: string; deviceType?: string; cid?: string; uuid?: string; speed?: number; rotationDirection?: 'clockwise' | 'counterclockwise'; oscillationState?: boolean; childLock?: boolean; mode?: 'normal' | 'auto' | 'sleep' | 'turbo'; } /** * Creates a mock fan instance for testing */ export declare const createMockFan: (config?: MockFanConfig) => jest.Mocked<VeSyncFan>; /** * Type for mock bulb configuration */ export interface MockBulbConfig { deviceName?: string; deviceType?: string; cid?: string; uuid?: string; brightness?: number; colorTemp?: number; hue?: number; saturation?: number; } /** * Creates a mock bulb instance for testing */ export declare const createMockBulb: (config?: MockBulbConfig) => jest.Mocked<VeSyncBulb>; //# sourceMappingURL=test-helpers.d.ts.map