80 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
		
		
			
		
	
	
			80 lines
		
	
	
		
			2.3 KiB
		
	
	
	
		
			TypeScript
		
	
	
	
	
	
| 
								 | 
							
								import { tap, expect } from '@push.rocks/tapbundle';
							 | 
						||
| 
								 | 
							
								import * as smartai from '../ts/index.js';
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								// Test research method stubs for providers without full implementation
							 | 
						||
| 
								 | 
							
								// These providers have research methods that throw "not yet supported" errors
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								tap.test('Research Stubs: Perplexity provider should have research method', async () => {
							 | 
						||
| 
								 | 
							
								  const perplexityProvider = new smartai.PerplexityProvider({
							 | 
						||
| 
								 | 
							
								    perplexityToken: 'test-token'
							 | 
						||
| 
								 | 
							
								  });
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  // Perplexity has a basic implementation with Sonar models
							 | 
						||
| 
								 | 
							
								  expect(typeof perplexityProvider.research).toEqual('function');
							 | 
						||
| 
								 | 
							
								});
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								tap.test('Research Stubs: Groq provider should throw not supported error', async () => {
							 | 
						||
| 
								 | 
							
								  const groqProvider = new smartai.GroqProvider({
							 | 
						||
| 
								 | 
							
								    groqToken: 'test-token'
							 | 
						||
| 
								 | 
							
								  });
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  expect(typeof groqProvider.research).toEqual('function');
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  let errorCaught = false;
							 | 
						||
| 
								 | 
							
								  try {
							 | 
						||
| 
								 | 
							
								    await groqProvider.research({ query: 'test' });
							 | 
						||
| 
								 | 
							
								  } catch (error) {
							 | 
						||
| 
								 | 
							
								    errorCaught = true;
							 | 
						||
| 
								 | 
							
								    expect(error.message).toInclude('not yet supported');
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								  expect(errorCaught).toBeTrue();
							 | 
						||
| 
								 | 
							
								});
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								tap.test('Research Stubs: Ollama provider should throw not supported error', async () => {
							 | 
						||
| 
								 | 
							
								  const ollamaProvider = new smartai.OllamaProvider({});
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  expect(typeof ollamaProvider.research).toEqual('function');
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  let errorCaught = false;
							 | 
						||
| 
								 | 
							
								  try {
							 | 
						||
| 
								 | 
							
								    await ollamaProvider.research({ query: 'test' });
							 | 
						||
| 
								 | 
							
								  } catch (error) {
							 | 
						||
| 
								 | 
							
								    errorCaught = true;
							 | 
						||
| 
								 | 
							
								    expect(error.message).toInclude('not yet supported');
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								  expect(errorCaught).toBeTrue();
							 | 
						||
| 
								 | 
							
								});
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								tap.test('Research Stubs: xAI provider should throw not supported error', async () => {
							 | 
						||
| 
								 | 
							
								  const xaiProvider = new smartai.XAIProvider({
							 | 
						||
| 
								 | 
							
								    xaiToken: 'test-token'
							 | 
						||
| 
								 | 
							
								  });
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  expect(typeof xaiProvider.research).toEqual('function');
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  let errorCaught = false;
							 | 
						||
| 
								 | 
							
								  try {
							 | 
						||
| 
								 | 
							
								    await xaiProvider.research({ query: 'test' });
							 | 
						||
| 
								 | 
							
								  } catch (error) {
							 | 
						||
| 
								 | 
							
								    errorCaught = true;
							 | 
						||
| 
								 | 
							
								    expect(error.message).toInclude('not yet supported');
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								  expect(errorCaught).toBeTrue();
							 | 
						||
| 
								 | 
							
								});
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								tap.test('Research Stubs: Exo provider should throw not supported error', async () => {
							 | 
						||
| 
								 | 
							
								  const exoProvider = new smartai.ExoProvider({});
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  expect(typeof exoProvider.research).toEqual('function');
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								  let errorCaught = false;
							 | 
						||
| 
								 | 
							
								  try {
							 | 
						||
| 
								 | 
							
								    await exoProvider.research({ query: 'test' });
							 | 
						||
| 
								 | 
							
								  } catch (error) {
							 | 
						||
| 
								 | 
							
								    errorCaught = true;
							 | 
						||
| 
								 | 
							
								    expect(error.message).toInclude('not yet supported');
							 | 
						||
| 
								 | 
							
								  }
							 | 
						||
| 
								 | 
							
								  expect(errorCaught).toBeTrue();
							 | 
						||
| 
								 | 
							
								});
							 | 
						||
| 
								 | 
							
								
							 | 
						||
| 
								 | 
							
								export default tap.start();
							 |