import { expect, tap } from '@git.zone/tstest/tapbundle'; import { createYeelightDiscoveryDescriptor } from '../../ts/integrations/yeelight/index.js'; tap.test('matches Yeelight SSDP wifi_bulb responses', async () => { const descriptor = createYeelightDiscoveryDescriptor(); const matcher = descriptor.getMatchers()[0]; const result = await matcher.matches({ location: 'yeelight://192.168.1.25:55443', id: '0x0000000002eb9f61', model: 'color', support: 'get_prop set_power set_bright set_rgb set_ct_abx', st: 'wifi_bulb', }, {}); expect(result.matched).toBeTrue(); expect(result.normalizedDeviceId).toEqual('0x0000000002eb9f61'); expect(result.candidate?.host).toEqual('192.168.1.25'); expect(result.candidate?.port).toEqual(55443); }); tap.test('matches Yeelight mDNS records', async () => { const descriptor = createYeelightDiscoveryDescriptor(); const matcher = descriptor.getMatchers()[1]; const result = await matcher.matches({ name: 'yeelink-light-color1_mibt1234', type: '_miio._udp.local.', host: 'yeelight-kitchen.local', txt: { id: '0x0000000002eb9f62', model: 'YLDP02YL', }, }, {}); expect(result.matched).toBeTrue(); expect(result.candidate?.manufacturer).toEqual('Yeelight'); }); export default tap.start();