Files
integrations/test/sonos/test.sonos.discovery.node.ts
2026-05-05 12:23:14 +00:00

18 lines
769 B
TypeScript

import { expect, tap } from '@git.zone/tstest/tapbundle';
import { createSonosDiscoveryDescriptor } from '../../ts/integrations/sonos/index.js';
tap.test('matches Sonos SSDP ZonePlayer records', async () => {
const descriptor = createSonosDiscoveryDescriptor();
const matcher = descriptor.getMatchers()[0];
const result = await matcher.matches({
st: 'urn:schemas-upnp-org:device:ZonePlayer:1',
usn: 'uuid:RINCON_000E58ABCDEF01400::urn:schemas-upnp-org:device:ZonePlayer:1',
location: 'http://192.168.1.55:1400/xml/device_description.xml',
}, {});
expect(result.matched).toBeTrue();
expect(result.candidate?.host).toEqual('192.168.1.55');
expect(result.normalizedDeviceId).toEqual('RINCON_000E58ABCDEF01400');
});
export default tap.start();