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

tap.test('keeps Improv BLE to safe snapshot inputs and documents the BLE stack blocker', async () => {
  const localApi = improvBleProfile.metadata.localApi as { implemented: string[]; explicitUnsupported: string[] };
  const client = new ImprovBleClient({ rawData: { device: { name: 'Improv Fixture' }, entities: [{ id: 'state', name: 'State', state: 'authorized' }] } });
  const snapshot = await client.getSnapshot();

  expect(snapshot.online).toBeTrue();
  expect(snapshot.source).toEqual('manual');
  expect(snapshot.entities[0].state).toEqual('authorized');
  expect(improvBleProfile.discoverySources).toContain('bluetooth');
  expect(localApi.implemented.some((itemArg) => itemArg.includes('safe manual snapshots'))).toBeTrue();
  expect(localApi.explicitUnsupported.some((itemArg) => itemArg.includes('py-improv-ble-client') && itemArg.includes('BLE stack'))).toBeTrue();
  expect(localApi.explicitUnsupported.some((itemArg) => itemArg.includes('Wi-Fi credential pairing'))).toBeTrue();
});

export default tap.start();
