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 { createRainbirdDiscoveryDescriptor } from '../../ts/integrations/rainbird/index.js';
|
||||
|
||||
tap.test('matches manual Rain Bird setup entries', async () => {
|
||||
const descriptor = createRainbirdDiscoveryDescriptor();
|
||||
const matcher = descriptor.getMatchers().find((matcherArg) => matcherArg.id === 'rainbird-manual-match');
|
||||
const result = await matcher!.matches({
|
||||
host: '192.168.1.40',
|
||||
protocol: 'http',
|
||||
macAddress: 'AA:BB:CC:12:34:56',
|
||||
model: 'Rain Bird ESP-TM2',
|
||||
}, {});
|
||||
expect(result.matched).toBeTrue();
|
||||
expect(result.normalizedDeviceId).toEqual('aabbcc123456');
|
||||
expect(result.candidate?.integrationDomain).toEqual('rainbird');
|
||||
expect(result.candidate?.port).toEqual(80);
|
||||
});
|
||||
|
||||
tap.test('validates Rain Bird candidates', async () => {
|
||||
const descriptor = createRainbirdDiscoveryDescriptor();
|
||||
const validator = descriptor.getValidators()[0];
|
||||
const result = await validator.validate({
|
||||
source: 'manual',
|
||||
integrationDomain: 'rainbird',
|
||||
host: 'rainbird.local',
|
||||
manufacturer: 'Rain Bird',
|
||||
}, {});
|
||||
expect(result.matched).toBeTrue();
|
||||
expect(result.candidate?.manufacturer).toEqual('Rain Bird');
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
Reference in New Issue
Block a user