import { expect, tap } from '@git.zone/tstest/tapbundle';
import * as qenv from '@push.rocks/qenv';

const testQenv = new qenv.Qenv('./', './.nogit/');

import * as smartai from '../ts/index.js';

let anthropicProvider: smartai.AnthropicProvider;

tap.test('Audio Stubs: should create Anthropic provider', async () => {
  anthropicProvider = new smartai.AnthropicProvider({
    anthropicToken: await testQenv.getEnvVarOnDemand('ANTHROPIC_TOKEN'),
  });
  await anthropicProvider.start();
});

tap.test('Audio Stubs: Anthropic audio should throw not supported error', async () => {
  let errorCaught = false;

  try {
    await anthropicProvider.audio({
      message: 'This should fail'
    });
  } catch (error) {
    errorCaught = true;
    expect(error.message).toInclude('not yet supported');
  }

  expect(errorCaught).toBeTrue();
});

tap.test('Audio Stubs: should stop Anthropic provider', async () => {
  await anthropicProvider.stop();
});

export default tap.start();
