32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { expect, tap } from '@git.zone/tstest/tapbundle';
|
|
import { SqueezeboxConfigFlow } from '../../ts/integrations/squeezebox/index.js';
|
|
|
|
tap.test('creates Squeezebox config from discovered host and credentials', async () => {
|
|
const flow = new SqueezeboxConfigFlow();
|
|
const step = await flow.start({
|
|
source: 'mdns',
|
|
integrationDomain: 'squeezebox',
|
|
id: 'server-uuid-1',
|
|
host: 'home-lms.local',
|
|
port: 9000,
|
|
name: 'Home LMS',
|
|
}, {});
|
|
|
|
expect(step.kind).toEqual('form');
|
|
const done = await step.submit!({ username: 'lms', password: 'secret', https: true, volumeStep: 10 });
|
|
expect(done.kind).toEqual('done');
|
|
expect(done.config?.host).toEqual('home-lms.local');
|
|
expect(done.config?.https).toBeTrue();
|
|
expect(done.config?.serverId).toEqual('server-uuid-1');
|
|
expect(done.config?.volumeStep).toEqual(10);
|
|
});
|
|
|
|
tap.test('requires an LMS host for manual setup', async () => {
|
|
const flow = new SqueezeboxConfigFlow();
|
|
const step = await flow.start({ source: 'manual', integrationDomain: 'squeezebox' }, {});
|
|
const result = await step.submit!({});
|
|
expect(result.kind).toEqual('error');
|
|
});
|
|
|
|
export default tap.start();
|