import { expect, tap } from '@git.zone/tstest/tapbundle'; import { createBleboxDiscoveryDescriptor } from '../../ts/integrations/blebox/index.js'; tap.test('matches BleBox zeroconf records and validates manual candidates', async () => { const descriptor = createBleboxDiscoveryDescriptor(); const mdnsMatcher = descriptor.getMatchers()[0]; const mdnsResult = await mdnsMatcher.matches({ name: 'blebox-1afe34e750b8', type: '_bbxsrv._tcp.local.', host: 'blebox.local', port: 80, txt: { id: '1afe34e750b8', type: 'switchBoxD', deviceName: 'Kitchen Switch', }, }, {}); expect(mdnsResult.matched).toBeTrue(); expect(mdnsResult.normalizedDeviceId).toEqual('1afe34e750b8'); expect(mdnsResult.candidate?.manufacturer).toEqual('BleBox'); const manualMatcher = descriptor.getMatchers()[1]; const manualResult = await manualMatcher.matches({ host: '192.168.1.50' }, {}); expect(manualResult.matched).toBeTrue(); expect(manualResult.candidate?.port).toEqual(80); const validator = descriptor.getValidators()[0]; const validResult = await validator.validate({ source: 'manual', integrationDomain: 'blebox', host: '192.168.1.50', port: 80, }, {}); expect(validResult.matched).toBeTrue(); }); export default tap.start();