Add native camera and media service integrations
This commit is contained in:
@@ -0,0 +1,32 @@
|
||||
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||
import { createSnapcastDiscoveryDescriptor } from '../../ts/integrations/snapcast/index.js';
|
||||
|
||||
tap.test('matches Snapcast mDNS control records', async () => {
|
||||
const descriptor = createSnapcastDiscoveryDescriptor();
|
||||
const matcher = descriptor.getMatchers()[0];
|
||||
const result = await matcher.matches({
|
||||
name: 'Snapcast',
|
||||
type: '_snapcast-ctrl._tcp.local.',
|
||||
host: 'snapserver.local',
|
||||
port: 1705,
|
||||
}, {});
|
||||
expect(result.matched).toBeTrue();
|
||||
expect(result.candidate?.integrationDomain).toEqual('snapcast');
|
||||
expect(result.candidate?.port).toEqual(1705);
|
||||
expect(result.metadata?.transport).toEqual('tcp');
|
||||
});
|
||||
|
||||
tap.test('matches and validates manual Snapcast entries', async () => {
|
||||
const descriptor = createSnapcastDiscoveryDescriptor();
|
||||
const matcher = descriptor.getMatchers()[1];
|
||||
const result = await matcher.matches({ host: '192.168.1.20', transport: 'http' }, {});
|
||||
expect(result.matched).toBeTrue();
|
||||
expect(result.candidate?.port).toEqual(1780);
|
||||
|
||||
const validator = descriptor.getValidators()[0];
|
||||
const validation = await validator.validate(result.candidate!, {});
|
||||
expect(validation.matched).toBeTrue();
|
||||
expect(validation.normalizedDeviceId).toEqual('192.168.1.20:1780');
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
Reference in New Issue
Block a user