Add native media and network integrations
This commit is contained in:
@@ -0,0 +1,52 @@
|
||||
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||
import { createAndroidtvDiscoveryDescriptor } from '../../ts/integrations/androidtv/index.js';
|
||||
|
||||
tap.test('matches Android TV mDNS setup hints', async () => {
|
||||
const descriptor = createAndroidtvDiscoveryDescriptor();
|
||||
const matcher = descriptor.getMatchers()[0];
|
||||
const result = await matcher.matches({
|
||||
type: '_androidtvremote2._tcp.local.',
|
||||
name: 'Living Room TV._androidtvremote2._tcp.local.',
|
||||
host: 'living-room-tv.local',
|
||||
port: 6466,
|
||||
txt: {
|
||||
id: 'androidtv-123',
|
||||
fn: 'Living Room TV',
|
||||
md: 'Android TV',
|
||||
},
|
||||
}, {});
|
||||
expect(result.matched).toBeTrue();
|
||||
expect(result.candidate?.host).toEqual('living-room-tv.local');
|
||||
expect(result.candidate?.port).toEqual(5555);
|
||||
expect(result.normalizedDeviceId).toEqual('androidtv-123');
|
||||
});
|
||||
|
||||
tap.test('matches manual Android TV host entries', async () => {
|
||||
const descriptor = createAndroidtvDiscoveryDescriptor();
|
||||
const matcher = descriptor.getMatchers()[1];
|
||||
const result = await matcher.matches({
|
||||
host: '192.168.1.55',
|
||||
deviceName: 'Den Fire TV',
|
||||
manufacturer: 'Amazon',
|
||||
model: 'Fire TV Stick',
|
||||
}, {});
|
||||
expect(result.matched).toBeTrue();
|
||||
expect(result.candidate?.host).toEqual('192.168.1.55');
|
||||
expect(result.candidate?.metadata?.deviceClass).toEqual('firetv');
|
||||
});
|
||||
|
||||
tap.test('validates ADB host candidates', async () => {
|
||||
const descriptor = createAndroidtvDiscoveryDescriptor();
|
||||
const validator = descriptor.getValidators()[0];
|
||||
const result = await validator.validate({
|
||||
source: 'custom',
|
||||
integrationDomain: 'androidtv',
|
||||
host: '192.168.1.56',
|
||||
port: 5555,
|
||||
model: 'Android TV',
|
||||
}, {});
|
||||
expect(result.matched).toBeTrue();
|
||||
expect(result.normalizedDeviceId).toEqual('192.168.1.56');
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
Reference in New Issue
Block a user