35 lines
1.1 KiB
TypeScript
35 lines
1.1 KiB
TypeScript
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
|
import { BluesoundConfigFlow } from '../../ts/integrations/bluesound/index.js';
|
|
|
|
tap.test('creates Bluesound config from discovered player host', async () => {
|
|
const flow = new BluesoundConfigFlow();
|
|
const step = await flow.start({
|
|
source: 'mdns',
|
|
integrationDomain: 'bluesound',
|
|
id: 'AA:BB:CC:DD:EE:01',
|
|
host: 'kitchen.local',
|
|
port: 11000,
|
|
name: 'Kitchen',
|
|
manufacturer: 'Bluesound',
|
|
model: 'NODE',
|
|
macAddress: 'AA:BB:CC:DD:EE:01',
|
|
}, {});
|
|
|
|
expect(step.kind).toEqual('form');
|
|
const done = await step.submit!({});
|
|
expect(done.kind).toEqual('done');
|
|
expect(done.config?.host).toEqual('kitchen.local');
|
|
expect(done.config?.port).toEqual(11000);
|
|
expect(done.config?.macAddress).toEqual('AA:BB:CC:DD:EE:01');
|
|
});
|
|
|
|
tap.test('requires a Bluesound host for manual setup', async () => {
|
|
const flow = new BluesoundConfigFlow();
|
|
const step = await flow.start({ source: 'manual', integrationDomain: 'bluesound' }, {});
|
|
const result = await step.submit!({});
|
|
|
|
expect(result.kind).toEqual('error');
|
|
});
|
|
|
|
export default tap.start();
|