Add native local infrastructure integrations
This commit is contained in:
@@ -0,0 +1,31 @@
|
||||
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
||||
import { HeosConfigFlow } from '../../ts/integrations/heos/index.js';
|
||||
|
||||
tap.test('creates HEOS config from discovered host and account options', async () => {
|
||||
const flow = new HeosConfigFlow();
|
||||
const step = await flow.start({
|
||||
source: 'ssdp',
|
||||
integrationDomain: 'heos',
|
||||
host: '192.168.1.80',
|
||||
name: 'Living Room HEOS',
|
||||
manufacturer: 'Denon',
|
||||
model: 'HEOS 7',
|
||||
serialNumber: 'HEOS12345',
|
||||
}, {});
|
||||
|
||||
expect(step.kind).toEqual('form');
|
||||
const done = await step.submit!({ username: 'listener@example.com', password: 'secret' });
|
||||
expect(done.kind).toEqual('done');
|
||||
expect(done.config?.host).toEqual('192.168.1.80');
|
||||
expect(done.config?.port).toEqual(1255);
|
||||
expect(done.config?.username).toEqual('listener@example.com');
|
||||
});
|
||||
|
||||
tap.test('requires a HEOS host for manual setup', async () => {
|
||||
const flow = new HeosConfigFlow();
|
||||
const step = await flow.start({ source: 'manual', integrationDomain: 'heos' }, {});
|
||||
const result = await step.submit!({});
|
||||
expect(result.kind).toEqual('error');
|
||||
});
|
||||
|
||||
export default tap.start();
|
||||
Reference in New Issue
Block a user