19 lines
708 B
TypeScript
19 lines
708 B
TypeScript
|
|
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||
|
|
import { createZwaveJsDiscoveryDescriptor } from '../../ts/integrations/zwave_js/index.js';
|
||
|
|
|
||
|
|
tap.test('matches Z-Wave JS Server mDNS records', async () => {
|
||
|
|
const descriptor = createZwaveJsDiscoveryDescriptor();
|
||
|
|
const matcher = descriptor.getMatchers()[0];
|
||
|
|
const result = await matcher.matches({
|
||
|
|
type: '_zwave-js-server._tcp.local.',
|
||
|
|
name: 'Z-Wave JS._zwave-js-server._tcp.local.',
|
||
|
|
host: 'zwave.local',
|
||
|
|
port: 3000,
|
||
|
|
}, {});
|
||
|
|
expect(result.matched).toBeTrue();
|
||
|
|
expect(result.candidate?.host).toEqual('zwave.local');
|
||
|
|
expect(result.candidate?.metadata?.url).toEqual('ws://zwave.local:3000');
|
||
|
|
});
|
||
|
|
|
||
|
|
export default tap.start();
|