Add native local device integrations

This commit is contained in:
2026-05-05 18:26:11 +00:00
parent accfa82f36
commit 282283d344
69 changed files with 9713 additions and 182 deletions
+37
View File
@@ -0,0 +1,37 @@
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();