37 lines
		
	
	
		
			973 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			37 lines
		
	
	
		
			973 B
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| 
								 | 
							
								import { expect, tap } from '@push.rocks/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();
							 |