import { expect, tap } from '@git.zone/tstest/tapbundle';
import { createRokuDiscoveryDescriptor } from '../../ts/integrations/roku/index.js';

tap.test('matches Roku ECP SSDP records', async () => {
  const descriptor = createRokuDiscoveryDescriptor();
  const matcher = descriptor.getMatchers()[0];
  const result = await matcher.matches({
    st: 'roku:ecp',
    usn: 'uuid:roku-ecp-123456::roku:ecp',
    location: 'http://192.168.1.60:8060/',
    headers: {
      manufacturer: 'Roku',
    },
  }, {});
  expect(result.matched).toBeTrue();
  expect(result.candidate?.host).toEqual('192.168.1.60');
  expect(result.normalizedDeviceId).toEqual('roku-ecp-123456');
});

export default tap.start();
