Add native media and network integrations
This commit is contained in:
@@ -0,0 +1,54 @@
|
||||
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||
import { createDenonavrDiscoveryDescriptor } from '../../ts/integrations/denonavr/index.js';
|
||||
|
||||
tap.test('matches Denon AVR SSDP records', async () => {
|
||||
const descriptor = createDenonavrDiscoveryDescriptor();
|
||||
const matcher = descriptor.getMatchers()[0];
|
||||
const result = await matcher.matches({
|
||||
st: 'urn:schemas-upnp-org:device:MediaRenderer:1',
|
||||
usn: 'uuid:denon-avr-123::urn:schemas-upnp-org:device:MediaRenderer:1',
|
||||
location: 'http://192.168.1.50:8080/description.xml',
|
||||
upnp: {
|
||||
manufacturer: 'Denon',
|
||||
modelName: 'AVR-X1700H',
|
||||
serialNumber: 'ABC12345',
|
||||
friendlyName: 'Living Room AVR',
|
||||
deviceType: 'urn:schemas-upnp-org:device:MediaRenderer:1',
|
||||
},
|
||||
}, {});
|
||||
expect(result.matched).toBeTrue();
|
||||
expect(result.candidate?.host).toEqual('192.168.1.50');
|
||||
expect(result.candidate?.manufacturer).toEqual('Denon');
|
||||
expect(result.normalizedDeviceId).toEqual('AVR-X1700H-ABC12345');
|
||||
});
|
||||
|
||||
tap.test('rejects HEOS speaker models', async () => {
|
||||
const descriptor = createDenonavrDiscoveryDescriptor();
|
||||
const matcher = descriptor.getMatchers()[0];
|
||||
const result = await matcher.matches({
|
||||
st: 'urn:schemas-upnp-org:device:MediaRenderer:1',
|
||||
location: 'http://192.168.1.51:8080/description.xml',
|
||||
upnp: {
|
||||
manufacturer: 'Denon',
|
||||
modelName: 'HEOS 5',
|
||||
serialNumber: 'HEOS123',
|
||||
},
|
||||
}, {});
|
||||
expect(result.matched).toBeFalse();
|
||||
});
|
||||
|
||||
tap.test('validates manual Marantz candidates', async () => {
|
||||
const descriptor = createDenonavrDiscoveryDescriptor();
|
||||
const validator = descriptor.getValidators()[0];
|
||||
const result = await validator.validate({
|
||||
source: 'manual',
|
||||
integrationDomain: 'denonavr',
|
||||
host: '192.168.1.52',
|
||||
manufacturer: 'Marantz',
|
||||
model: 'SR6015',
|
||||
}, {});
|
||||
expect(result.matched).toBeTrue();
|
||||
expect(result.confidence).toEqual('high');
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
Reference in New Issue
Block a user