Files
integrations/test/shelly/test.shelly.discovery.node.ts
T

22 lines
724 B
TypeScript

import { expect, tap } from '@git.zone/tstest/tapbundle';
import { createShellyDiscoveryDescriptor } from '../../ts/integrations/shelly/index.js';
tap.test('matches Shelly zeroconf records', async () => {
const descriptor = createShellyDiscoveryDescriptor();
const matcher = descriptor.getMatchers()[0];
const result = await matcher.matches({
name: 'shellyplus1pm-a8032abe54dc',
type: '_http._tcp.local.',
host: 'shellyplus1pm-a8032abe54dc.local',
port: 80,
txt: {
id: 'shellyplus1pm-a8032abe54dc',
model: 'SNSW-001P16EU',
},
}, {});
expect(result.matched).toBeTrue();
expect(result.normalizedDeviceId).toEqual('shellyplus1pm-a8032abe54dc');
});
export default tap.start();