Skip to content

🤯 LobeHub - Super-Agents on Your Team. Add super-agents to the chats your team already uses.They take on work by themselves and get better every week.

♻️ test: prune redundant cases without reducing measured coverage (#19940)

AmAzing-a950e51f59c9
diff --git a/apps/server/src/routers/lambda/__tests__/pushToken.test.ts b/apps/server/src/routers/lambda/__tests__/pushToken.test.ts
index 4c3ed618cf2..1c0e9bef0c9 100644
--- a/apps/server/src/routers/lambda/__tests__/pushToken.test.ts
+++ b/apps/server/src/routers/lambda/__tests__/pushToken.test.ts
@@ -193,30 +193,6 @@ describe('pushTokenRouter', () => {
expectTypeOf(result.interventionStatus).toEqualTypeOf<AgentInterventionReviewStatus>();
});
- it.each([
- { interventionStatus: 'approved', interventionTerminal: true },
- { interventionStatus: 'rejected', interventionTerminal: true },
- { interventionStatus: 'mixed', interventionTerminal: false },
- { interventionStatus: 'mixed', interventionTerminal: true },
- ] satisfies LiveActivityBusiness.RegisterAgentInterventionLiveActivityResult[])(
- 'preserves generic status $interventionStatus with terminal=$interventionTerminal',
- async (registrationResult) => {
- mockRegisterLiveActivity.mockResolvedValueOnce(registrationResult);
- const caller = createCaller();
-
- const result = await caller.registerLiveActivity({
- activityId: 'native-activity-1',
- activityKey: 'batch-1',
- apnsEnvironment: 'sandbox',
- deviceId: 'iphone',
- operationId: 'op-1',
- pushToken: 'activity-update-token',
- });
-
- expect(result).toEqual(registrationResult);
- },
- );
-
it('rejects a legacy activityId-only registration without a durable activityKey', async () => {
const caller = createCaller();
await expect(
diff --git a/apps/server/src/services/connector/refresh.test.ts b/apps/server/src/services/connector/refresh.test.ts
index 5c3166ae1a2..4c278cfcf25 100644
--- a/apps/server/src/services/connector/refresh.test.ts
+++ b/apps/server/src/services/connector/refresh.test.ts
@@ -174,13 +174,6 @@ describe('scheduleStaleConnectorToolsRefresh — eligibility', () => {
});
describe('scheduleStaleConnectorToolsRefresh — remote result handling', () => {
- it('completes cleanly when the remote sync succeeds', async () => {
- const id = nextId();
- scheduleStaleConnectorToolsRefresh([httpConnector(id)], new Map(), ctx, NOW);
- await expect(flushDeferred()).resolves.toBeUndefined();
- expect(syncConnectorToolsById).toHaveBeenCalledTimes(1);
- });
-
it('swallows a remote sync failure (never rejects, never surfaces)', async () => {
const id = nextId();
vi.mocked(syncConnectorToolsById).mockRejectedValueOnce(new Error('remote MCP down'));
@@ -189,21 +182,6 @@ describe('scheduleStaleConnectorToolsRefresh — remote result handling', () =>
await expect(flushDeferred()).resolves.toBeUndefined();
});
- it('re-syncs once the TTL has elapsed since the last attempt', async () => {
- const id = nextId();
- scheduleStaleConnectorToolsRefresh([httpConnector(id)], new Map(), ctx, NOW);
- await flushDeferred();
- // Past the TTL → eligible again even though the DB marker never advanced.
- scheduleStaleConnectorToolsRefresh(
- [httpConnector(id)],
- new Map(),
- ctx,
- NOW + CONNECTOR_TOOLS_REFRESH_TTL_MS + 1,
- );
- await flushDeferred();
- expect(syncConnectorToolsById).toHaveBeenCalledTimes(2);
- });
-
it('backs off a failed connector for a TTL, then retries', async () => {
const id = nextId();
vi.mocked(syncConnectorToolsById).mockRejectedValueOnce(new Error('remote MCP down'));
diff --git a/packages/builtin-tool-calculator/src/calculate.test.ts b/packages/builtin-tool-calculator/src/calculate.test.ts
index 8851e822d32..190cef25a3a 100644
--- a/packages/builtin-tool-calculator/src/calculate.test.ts
+++ b/packages/builtin-tool-calculator/src/calculate.test.ts
@@ -20,18 +20,6 @@ describe('Unit Conversion', () => {
expect(parseFloat(celsius.content || '0')).toBeCloseTo(0, 0);
});
- it('should handle length conversions with mathjs syntax', async () => {
- const result = await calculatorExecutor.calculate({ expression: '5 cm to inch' });
- expect(result.success).toBe(true);
- expect(parseFloat(result.content || '0')).toBeCloseTo(1.9685, 3);
- });
-
- it('should handle weight conversions', async () => {
- const result = await calculatorExecutor.calculate({ expression: '1 kg to lb' });
- expect(result.success).toBe(true);
- expect(parseFloat(result.content || '0')).toBeCloseTo(2.2046, 3);
- });
-
it('should handle speed conversions', async () => {
const result = await calculatorExecutor.calculate({ expression: '100 km/h to mph' });
// Note: This might fail depending on mathjs unit support
@@ -44,11 +32,6 @@ describe('Unit Conversion', () => {
}
});
- it('should handle invalid temperature syntax gracefully', async () => {
- const result = await calculatorExecutor.calculate({ expression: '25 °C to °F' });
- // This might fail due to Unicode degree symbol
- console.log('Unicode result:', result.content, result.success);
- });
describe('Calculator Calculus', () => {
describe('differentiate', () => {
it('should differentiate polynomial expressions', async () => {
@@ -591,18 +574,6 @@ describe('Calculator Base Conversion', () => {
expect(result.state?.decimalValue).toBe(10);
});
- it('should base decimal to binary', async () => {
- const result = await calculatorExecutor.base({
- number: '255',
- fromBase: 10,
- toBase: 2,
- });
-
- expect(result.success).toBe(true);
- expect(result.content).toBe('11111111');
- expect(result.state?.decimalValue).toBe(255);
- });
-
it('should base hexadecimal to octal', async () => {
const result = await calculatorExecutor.base({
number: 'FF',
@@ -674,17 +645,6 @@ describe('Calculator Base Conversion', () => {
expect(result.state?.decimalValue).toBe(1000);
});
- it('should handle invalid base numbers', async () => {
- const result = await calculatorExecutor.base({
- number: '123',
- fromBase: 1,
- toBase: 10,
- });
-
- expect(result.success).toBe(false);
- expect(result.error?.type).toBe('ConversionError');
- });
-
it('should handle invalid base 37', async () => {
const result = await calculatorExecutor.base({
number: '123',
@@ -695,17 +655,6 @@ describe('Calculator Base Conversion', () => {
expect(result.success).toBe(false);
expect(result.error?.type).toBe('ConversionError');
});
-
- it('should validate digit characters for base', async () => {
- const result = await calculatorExecutor.base({
- number: 'G',
- fromBase: 16,
- toBase: 10,
- });
-
- expect(result.success).toBe(false);
- expect(result.error?.type).toBe('ConversionError');
- });
});
describe('Calculator Core Functions', () => {
@@ -976,28 +925,6 @@ describe('Calculator Core Functions', () => {
describe('Calculator Sorting', () => {
describe('sort', () => {
- it('should default to sorted array when no mode provided', async () => {
- const result = await calculatorExecutor.sort({
- numbers: [3.14, 2.718],
- });
-
- expect(result.success).toBe(true);
- const parsed = JSON.parse(result.content || '{}');
- expect(Array.isArray(parsed)).toBe(true);
- expect(parsed).toEqual(['2.718', '3.14']);
- });
-
- it('should return sorted array when no mode provided', async () => {
- const result = await calculatorExecutor.sort({
- numbers: [3.14, 2.718, 1.618, 4.669],
- });
-
- expect(result.success).toBe(true);
- const parsed = JSON.parse(result.content || '{}');
- expect(Array.isArray(parsed)).toBe(true);
- expect(parsed).toEqual(['1.618', '2.718', '3.14', '4.669']);
- });
-
it('should return largest value only in largest mode', async () => {
const result = await calculatorExecutor.sort({
numbers: [3.14, 2.718, 1.618, 4.669],
diff --git a/packages/context-engine/src/__tests__/pipeline.test.ts b/packages/context-engine/src/__tests__/pipeline.test.ts
index f0cf8ea2521..02a9e09a31d 100644
--- a/packages/context-engine/src/__tests__/pipeline.test.ts
+++ b/packages/context-engine/src/__tests__/pipeline.test.ts
@@ -182,16 +182,6 @@ describe('ContextEngine', () => {
expect(result.stats.processedCount).toBe(3);
});
- it('should handle messages array correctly', async () => {
- const processor = createMockProcessor('p1');
- const engine = new ContextEngine({ pipeline: [processor] });
-
- const input = createInitialContext();
- const result = await engine.process(input);
-
- expect(result.messages).toEqual(input.messages);
- });
-
it('should handle empty messages', async () => {
const processor = createMockProcessor('p1');
const engine = new ContextEngine({ pipeline: [processor] });
@@ -248,27 +238,6 @@ describe('ContextEngine', () => {
expect(processor3.process).not.toHaveBeenCalled();
});
- it('should skip remaining processors if context is already aborted', async () => {
- const processor1: ContextProcessor = {
- name: 'p1',
- process: vi.fn(async (context) => ({
- ...context,
- isAborted: true,
- })),
- };
- const processor2 = createMockProcessor('p2');
-
- const engine = new ContextEngine({
- pipeline: [processor1, processor2],
- });
-
- const result = await engine.process(createInitialContext());
-
- expect(result.isAborted).toBe(true);
- expect(result.stats.processedCount).toBe(1);
- expect(processor2.process).not.toHaveBeenCalled();
- });
-
it('should throw PipelineError when processor fails', async () => {
const error = new Error('processor failed');
const processor = createErrorProcessor('failing-processor', error);
diff --git a/packages/context-engine/src/engine/tools/__tests__/ToolNameResolver.test.ts b/packages/context-engine/src/engine/tools/__tests__/ToolNameResolver.test.ts
index b55abb6f53b..26fa1374690 100644
--- a/packages/context-engine/src/engine/tools/__tests__/ToolNameResolver.test.ts
+++ b/packages/context-engine/src/engine/tools/__tests__/ToolNameResolver.test.ts
@@ -24,11 +24,6 @@ describe('ToolNameResolver', () => {
const result = resolver.generate('test-plugin', 'myAction', 'default');
expect(result).toBe('test-plugin____myAction');
});
-
- it('should handle undefined type as builtin', () => {
- const result = resolver.generate('test-plugin', 'myAction');
- expect(result).toBe('test-plugin____myAction');
- });
});
describe('generate - long name handling', () => {
diff --git a/packages/context-engine/src/engine/tools/__tests__/ToolsEngine.test.ts b/packages/context-engine/src/engine/tools/__tests__/ToolsEngine.test.ts
index c4a02dae579..45f6b275b86 100644
--- a/packages/context-engine/src/engine/tools/__tests__/ToolsEngine.test.ts
+++ b/packages/context-engine/src/engine/tools/__tests__/ToolsEngine.test.ts
@@ -799,42 +799,9 @@ describe('ToolsEngine', () => {
// Ensure URL is not included
expect(result![0].function).not.toHaveProperty('url');
});
-
- it('should preserve all other API properties correctly', () => {
- const engine = createTestEngine();
- const result = engine.generateTools({
- toolIds: ['plugin-3'],
- model: 'gpt-4',
- provider: 'openai',
- });
-
- const func = result![0].function;
- expect(func.description).toBe('123123');
- expect(func.name).toBe('plugin-3____api-3');
- expect(func.parameters).toEqual({
- type: 'object',
- properties: { a: { type: 'string' } },
- required: [],
- });
- });
});
describe('function calling support', () => {
- it('should return undefined when function calling is not supported', () => {
- const engine = new ToolsEngine({
- manifestSchemas: mockManifests,
- functionCallChecker: () => false, // Disable function calls
- });
-
- const result = engine.generateTools({
- toolIds: ['plugin-1'],
- model: 'gpt-3.5-turbo',
- provider: 'openai',
- });
-
- expect(result).toBeUndefined();
- });
-
it('should respect function calling checker logic', () => {
const engine = new ToolsEngine({
manifestSchemas: mockManifests,
@@ -877,45 +844,6 @@ describe('ToolsEngine', () => {
expect(result).toHaveLength(1);
expect(result![0].function.name).toBe('plugin-1____api-1');
});
-
- it('should return undefined when no plugins are enabled', () => {
- const engine = new ToolsEngine({
- manifestSchemas: mockManifests,
- functionCallChecker: () => true,
- enableChecker: () => false, // Disable all plugins
- });
-
- const result = engine.generateTools({
- toolIds: ['plugin-1', 'plugin-2'],
- model: 'gpt-4',
- provider: 'openai',
- });
-
- expect(result).toBeUndefined();
- });
- });
-
- describe('detailed generation results', () => {
- it('should provide detailed filtering information', () => {
- const engine = new ToolsEngine({
- manifestSchemas: mockManifests,
- functionCallChecker: () => true,
- enableChecker: ({ pluginId }) => pluginId === 'plugin-1',
- });
-
- const result = engine.generateToolsDetailed({
- toolIds: ['plugin-1', 'plugin-2', 'non-existent'],
- model: 'gpt-4',
- provider: 'openai',
- });
-
- expect(result.tools).toHaveLength(1);
- expect(result.enabledToolIds).toEqual(['plugin-1']);
- expect(result.filteredTools).toEqual([
- { id: 'plugin-2', reason: 'disabled' },
- { id: 'non-existent', reason: 'not_found' },
- ]);
- });
});
});
@@ -947,68 +875,8 @@ describe('ToolsEngine', () => {
},
type: 'default',
},
- {
- identifier: 'standalone-plugin',
- api: [{ name: 'standalone-api', description: 'Standalone API', parameters: {} }],
- meta: {
- title: 'Standalone Plugin',
- description: 'Standalone plugin description',
- avatar: '🔩',
- },
- type: 'standalone',
- },
];
- describe('basic functionality comparison', () => {
- it('should generate the same tool names as enabledSchema did', () => {
- const engine = new ToolsEngine({
- manifestSchemas: sampleManifests,
- functionCallChecker: () => true,
- });
-
- const result = engine.generateTools({
- toolIds: ['plugin-1', 'plugin-2'],
- model: 'gpt-4',
- provider: 'openai',
- });
-
- // These should match the format that enabledSchema produced
- expect(result).toEqual([
- {
- type: 'function',
- function: {
- name: 'plugin-1____api-1',
- description: 'API 1',
- parameters: {},
- },
- },
- {
- type: 'function',
- function: {
- name: 'plugin-2____api-2',
- description: 'API 2',
- parameters: {},
- },
- },
- ]);
- });
-
- it('should handle type suffixes the same way enabledSchema did', () => {
- const engine = new ToolsEngine({
- manifestSchemas: sampleManifests,
- functionCallChecker: () => true,
- });
-
- const result = engine.generateTools({
- toolIds: ['standalone-plugin'],
- model: 'gpt-4',
- provider: 'openai',
- });
-
- expect(result![0].function.name).toBe('standalone-plugin____standalone-api____standalone');
- });
- });
-
describe('advantages of ToolsEngine over enabledSchema', () => {
it('provides detailed filtering information that enabledSchema could not', () => {
const engine = new ToolsEngine({
@@ -1053,59 +921,6 @@ describe('ToolsEngine', () => {
],
});
});
-
- it('supports function calling checks that enabledSchema relied on external logic for', () => {
- const engine = new ToolsEngine({
- manifestSchemas: sampleManifests,
- functionCallChecker: (model: string) => model.includes('gpt-4'),
- });
-
- // Should work with GPT-4
- const result1 = engine.generateTools({
- toolIds: ['plugin-1'],
- model: 'gpt-4',
- provider: 'openai',
- });
- expect(result1).toBeDefined();
-
- // Should not work with older models
- const result2 = engine.generateTools({
- toolIds: ['plugin-1'],
- model: 'gpt-3.5-turbo',
- provider: 'openai',
- });
- expect(result2).toBeUndefined();
- });
-
- it('encapsulates all tool generation logic in one place', () => {
- // This demonstrates that ToolsEngine combines:
- // 1. Manifest filtering (what enabledSchema did)
- // 2. Function calling support checks (what prepareTools did)
- // 3. Tool name generation (what genToolCallingName did)
- // 4. Plugin enable checking (custom logic)
-
- const engine = new ToolsEngine({
- manifestSchemas: sampleManifests,
- functionCallChecker: (model: string, provider: string) => {
- return model.includes('gpt') && provider === 'openai';
- },
- enableChecker: ({ pluginId, model }) => {
- // Custom business logic that was scattered before
- if (model === 'gpt-3.5-turbo') return false;
- return pluginId !== 'plugin-2'; // Skip plugin-2 for demo
- },
- });
-
- const result = engine.generateTools({
- toolIds: ['plugin-1', 'plugin-2'],
- model: 'gpt-4',
- provider: 'openai',
- });
-
- // Only plugin-1 should be enabled due to custom logic
- expect(result).toHaveLength(1);
- expect(result![0].function.name).toBe('plugin-1____api-1');
- });
});
});
diff --git a/packages/context-engine/src/processors/__tests__/PlaceholderVariables.test.ts b/packages/context-engine/src/processors/__tests__/PlaceholderVariables.test.ts
index 75191f66ee3..3b4d474fd9a 100644
--- a/packages/context-engine/src/processors/__tests__/PlaceholderVariables.test.ts
+++ b/packages/context-engine/src/processors/__tests__/PlaceholderVariables.test.ts
@@ -249,48 +249,6 @@ describe('PlaceholderVariablesProcessor', () => {
expect(result.metadata.placeholderVariablesProcessed).toBe(1);
});
- it('should handle processing errors gracefully', async () => {
- const faultyGenerators = {
- error: () => {
- throw new Error('Generator error');
- },
- working: () => 'works',
- };
-
- const processor = new PlaceholderVariablesProcessor({
- variableGenerators: faultyGenerators,
- });
-
- const context = {
- initialState: {
- messages: [],
- model: 'gpt-4',
- provider: 'openai',
- systemRole: '',
- tools: [],
- },
- messages: [
- {
- id: '1',
- role: 'user',
- content: 'This {{working}} but this {{error}} fails',
- createdAt: Date.now(),
- updatedAt: Date.now(),
- },
- ],
- metadata: {
- model: 'gpt-4',
- maxTokens: 4096,
- },
- isAborted: false,
- executedProcessors: [],
- };
-
- // Should not throw, but continue processing
- const result = await processor.process(context);
- expect(result.messages).toHaveLength(1);
- });
-
it('should isolate generator throws per message and not over-count', async () => {
const faultyGenerators = {
error: () => {
diff --git a/packages/context-engine/src/processors/__tests__/PlaceholderVariables.toolResultPassthrough.test.ts b/packages/context-engine/src/processors/__tests__/PlaceholderVariables.toolResultPassthrough.test.ts
index 04058f462d0..cf870598e0a 100644
--- a/packages/context-engine/src/processors/__tests__/PlaceholderVariables.toolResultPassthrough.test.ts
+++ b/packages/context-engine/src/processors/__tests__/PlaceholderVariables.toolResultPassthrough.test.ts
@@ -46,31 +46,6 @@ describe('PlaceholderVariablesProcessor — tool result passthrough', () => {
expect(result.messages[0].content).toBe(diff);
});
- it('renders the same tool result identically across repeated calls', async () => {
- const diff = 'Updated {{time}} / {{timestamp}}';
- const render = async () => {
- const processor = new PlaceholderVariablesProcessor({
- variableGenerators: {
- time: () => new Date().toISOString(),
- timestamp: () => Date.now().toString(),
- },
- });
- const ctx = buildContext([
- {
- role: 'tool',
- tool_call_id: 't1',
- name: 'lobe-local-system____runCommand',
- content: diff,
- },
- ]);
- return (await processor.process(ctx)).messages[0].content;
- };
-
- // Byte-stability across calls is the whole point: an unstable byte here is
- // a broken cache prefix and a ~50x price on every token that follows.
- expect(await render()).toBe(await render());
- });
-
it('identifies the tool from `plugin` when the wire name is absent', async () => {
const processor = new PlaceholderVariablesProcessor({ variableGenerators: timeGenerators });
diff --git a/packages/model-runtime/src/providerTestUtils.test.ts b/packages/model-runtime/src/providerTestUtils.test.ts
index 7449e3e635b..884821673fb 100644
--- a/packages/model-runtime/src/providerTestUtils.test.ts
+++ b/packages/model-runtime/src/providerTestUtils.test.ts
@@ -38,28 +38,4 @@ describe('testProvider', () => {
provider: 'TestProvider',
});
});
-
- describe('should handle OpenAI API errors correctly', () => {
- testProvider({
- Runtime: createTestRuntime(),
- bizErrorType: 'TestBizError',
- chatDebugEnv: 'TEST_DEBUG',
- chatModel: 'test-model',
- defaultBaseURL: 'https://default.test',
- invalidErrorType: 'InvalidAPIKey',
- provider: 'TestProvider',
- });
- });
-
- describe('should handle debug stream correctly', () => {
- testProvider({
- Runtime: createTestRuntime(),
- bizErrorType: 'TestBizError',
- chatDebugEnv: 'TEST_DEBUG',
- chatModel: 'test-model',
- defaultBaseURL: 'https://default.test',
- invalidErrorType: 'InvalidAPIKey',
- provider: 'TestProvider',
- });
- });
});
diff --git a/packages/model-runtime/src/providers/ai360/index.test.ts b/packages/model-runtime/src/providers/ai360/index.test.ts
index 923c2c6e6c7..d283657ca05 100644
--- a/packages/model-runtime/src/providers/ai360/index.test.ts
+++ b/packages/model-runtime/src/providers/ai360/index.test.ts
@@ -2,23 +2,8 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import { LobeAi360AI, params } from './index';
-testProvider({
- Runtime: LobeAi360AI,
- provider: ModelProvider.Ai360,
- defaultBaseURL: 'https://api.360.cn/v1',
- chatDebugEnv: 'DEBUG_AI360_CHAT_COMPLETION',
- chatModel: 'deepseek-r1',
- invalidErrorType: 'InvalidProviderAPIKey',
- bizErrorType: 'ProviderBizError',
- test: {
- skipAPICall: true,
- skipErrorHandle: true,
- },
-});
-
describe('LobeAi360AI - custom features', () => {
let instance: InstanceType<typeof LobeAi360AI>;
diff --git a/packages/model-runtime/src/providers/akashchat/index.test.ts b/packages/model-runtime/src/providers/akashchat/index.test.ts
index f9c366fd1eb..3ed0cff8ada 100644
--- a/packages/model-runtime/src/providers/akashchat/index.test.ts
+++ b/packages/model-runtime/src/providers/akashchat/index.test.ts
@@ -2,7 +2,6 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import { LobeAkashChatAI, params } from './index';
const loadModelsMock = vi.hoisted(() => vi.fn().mockResolvedValue([]));
@@ -11,23 +10,6 @@ vi.mock('@lobechat/business-model-bank/model-config', () => ({
loadModels: loadModelsMock,
}));
-const provider = ModelProvider.AkashChat;
-const defaultBaseURL = 'https://chatapi.akash.network/api/v1';
-
-testProvider({
- Runtime: LobeAkashChatAI,
- bizErrorType: 'ProviderBizError',
- chatDebugEnv: 'DEBUG_AKASH_CHAT_COMPLETION',
- chatModel: 'llama-3.1-8b-instruct',
- defaultBaseURL,
- invalidErrorType: 'InvalidProviderAPIKey',
- provider,
- test: {
- skipAPICall: true,
- skipErrorHandle: true,
- },
-});
-
describe('LobeAkashChatAI - custom features', () => {
let instance: InstanceType<typeof LobeAkashChatAI>;
diff --git a/packages/model-runtime/src/providers/cerebras/index.test.ts b/packages/model-runtime/src/providers/cerebras/index.test.ts
index 0e308bd042d..3524ff3eeea 100644
--- a/packages/model-runtime/src/providers/cerebras/index.test.ts
+++ b/packages/model-runtime/src/providers/cerebras/index.test.ts
@@ -2,7 +2,6 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import { LobeCerebrasAI, params } from './index';
const loadModelsMock = vi.hoisted(() => vi.fn().mockResolvedValue([]));
@@ -11,20 +10,6 @@ vi.mock('@lobechat/business-model-bank/model-config', () => ({
loadModels: loadModelsMock,
}));
-testProvider({
- Runtime: LobeCerebrasAI,
- bizErrorType: 'ProviderBizError',
- chatDebugEnv: 'DEBUG_CEREBRAS_CHAT_COMPLETION',
- chatModel: 'llama3.1-8b',
- defaultBaseURL: 'https://api.cerebras.ai/v1',
- invalidErrorType: 'InvalidProviderAPIKey',
- provider: ModelProvider.Cerebras,
- test: {
- skipAPICall: true,
- skipErrorHandle: true,
- },
-});
-
describe('LobeCerebrasAI - custom features', () => {
let instance: InstanceType<typeof LobeCerebrasAI>;
diff --git a/packages/model-runtime/src/providers/cohere/index.test.ts b/packages/model-runtime/src/providers/cohere/index.test.ts
index ecd0e224246..29c4c2bc99e 100644
--- a/packages/model-runtime/src/providers/cohere/index.test.ts
+++ b/packages/model-runtime/src/providers/cohere/index.test.ts
@@ -3,23 +3,8 @@ import { ModelProvider } from 'model-bank';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { LobeOpenAICompatibleRuntime } from '../../core/BaseAI';
-import { testProvider } from '../../providerTestUtils';
import { LobeCohereAI, params } from './index';
-const provider = ModelProvider.Cohere;
-const defaultBaseURL = 'https://api.cohere.ai/compatibility/v1';
-
-testProvider({
- Runtime: LobeCohereAI,
- provider,
- defaultBaseURL,
- chatDebugEnv: 'DEBUG_COHERE_CHAT_COMPLETION',
- chatModel: 'command-r7b',
- test: {
- skipAPICall: true,
- },
-});
-
// Mock the console.error to avoid polluting test output
vi.spyOn(console, 'error').mockImplementation(() => {});
diff --git a/packages/model-runtime/src/providers/cometapi/index.test.ts b/packages/model-runtime/src/providers/cometapi/index.test.ts
index 804035cc3ff..b8535de944b 100644
--- a/packages/model-runtime/src/providers/cometapi/index.test.ts
+++ b/packages/model-runtime/src/providers/cometapi/index.test.ts
@@ -2,7 +2,6 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import { LobeCometAPIAI, params } from './index';
const loadModelsMock = vi.hoisted(() => vi.fn().mockResolvedValue([]));
@@ -11,18 +10,6 @@ vi.mock('@lobechat/business-model-bank/model-config', () => ({
loadModels: loadModelsMock,
}));
-// Basic provider tests
-testProvider({
- Runtime: LobeCometAPIAI,
- chatDebugEnv: 'DEBUG_COMETAPI_COMPLETION',
- chatModel: 'gpt-3.5-turbo',
- defaultBaseURL: 'https://api.cometapi.com/v1',
- provider: ModelProvider.CometAPI,
- test: {
- skipAPICall: true,
- },
-});
-
// Custom feature tests
describe('LobeCometAPIAI - custom features', () => {
let instance: InstanceType<typeof LobeCometAPIAI>;
diff --git a/packages/model-runtime/src/providers/fireworksai/index.test.ts b/packages/model-runtime/src/providers/fireworksai/index.test.ts
index 2ef2521e7f8..4c63b893aed 100644
--- a/packages/model-runtime/src/providers/fireworksai/index.test.ts
+++ b/packages/model-runtime/src/providers/fireworksai/index.test.ts
@@ -2,28 +2,12 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import type { FireworksAIModelCard } from './index';
-import { LobeFireworksAI, params } from './index';
+import { params } from './index';
const provider = ModelProvider.FireworksAI;
const defaultBaseURL = 'https://api.fireworks.ai/inference/v1';
-// Basic provider tests
-testProvider({
- Runtime: LobeFireworksAI,
- bizErrorType: 'ProviderBizError',
- chatDebugEnv: 'DEBUG_FIREWORKSAI_CHAT_COMPLETION',
- chatModel: 'deepseek-r1',
- defaultBaseURL,
- invalidErrorType: 'InvalidProviderAPIKey',
- provider,
- test: {
- skipAPICall: true,
- skipErrorHandle: true,
- },
-});
-
// Custom feature tests
describe('LobeFireworksAI - custom features', () => {
describe('params export', () => {
diff --git a/packages/model-runtime/src/providers/giteeai/index.test.ts b/packages/model-runtime/src/providers/giteeai/index.test.ts
index 99f43e28bc1..25cc5b35767 100644
--- a/packages/model-runtime/src/providers/giteeai/index.test.ts
+++ b/packages/model-runtime/src/providers/giteeai/index.test.ts
@@ -2,7 +2,6 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import { LobeGiteeAI, params } from './index';
const loadModelsMock = vi.hoisted(() => vi.fn().mockResolvedValue([]));
@@ -11,14 +10,6 @@ vi.mock('@lobechat/business-model-bank/model-config', () => ({
loadModels: loadModelsMock,
}));
-testProvider({
- Runtime: LobeGiteeAI,
- chatDebugEnv: 'DEBUG_GITEE_AI_CHAT_COMPLETION',
- chatModel: 'deepseek-r1',
- defaultBaseURL: 'https://ai.gitee.com/v1',
- provider: ModelProvider.GiteeAI,
-});
-
describe('LobeGiteeAI - custom features', () => {
let instance: InstanceType<typeof LobeGiteeAI>;
diff --git a/packages/model-runtime/src/providers/github/index.test.ts b/packages/model-runtime/src/providers/github/index.test.ts
index b9e49e0fd53..6ecd14c7101 100644
--- a/packages/model-runtime/src/providers/github/index.test.ts
+++ b/packages/model-runtime/src/providers/github/index.test.ts
@@ -2,20 +2,9 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import type { GithubModelCard } from './index';
import { LobeGithubAI, params } from './index';
-// Basic provider tests
-testProvider({
- Runtime: LobeGithubAI,
- chatDebugEnv: 'DEBUG_GITHUB_CHAT_COMPLETION',
- chatModel: 'openai/gpt-4o',
- defaultBaseURL: 'https://models.github.ai/inference',
- invalidErrorType: 'InvalidGithubToken',
- provider: ModelProvider.Github,
-});
-
// Custom feature tests
describe('LobeGithubAI - custom features', () => {
let instance: InstanceType<typeof LobeGithubAI>;
diff --git a/packages/model-runtime/src/providers/jina/index.test.ts b/packages/model-runtime/src/providers/jina/index.test.ts
index b279905c10a..e5d72186c39 100644
--- a/packages/model-runtime/src/providers/jina/index.test.ts
+++ b/packages/model-runtime/src/providers/jina/index.test.ts
@@ -2,28 +2,12 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import type { JinaModelCard } from './index';
-import { LobeJinaAI, params } from './index';
+import { params } from './index';
const provider = ModelProvider.Jina;
const defaultBaseURL = 'https://deepsearch.jina.ai/v1';
-// Basic provider tests
-testProvider({
- Runtime: LobeJinaAI,
- bizErrorType: 'ProviderBizError',
- chatDebugEnv: 'DEBUG_JINA_CHAT_COMPLETION',
- chatModel: 'jina-embeddings-v3',
- defaultBaseURL,
- invalidErrorType: 'InvalidProviderAPIKey',
- provider,
- test: {
- skipAPICall: true,
- skipErrorHandle: true,
- },
-});
-
// Custom feature tests
describe('LobeJinaAI - custom features', () => {
describe('params export', () => {
diff --git a/packages/model-runtime/src/providers/lmstudio/index.test.ts b/packages/model-runtime/src/providers/lmstudio/index.test.ts
index 93de8c8d126..7b4bad83cb8 100644
--- a/packages/model-runtime/src/providers/lmstudio/index.test.ts
+++ b/packages/model-runtime/src/providers/lmstudio/index.test.ts
@@ -2,23 +2,8 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import { LobeLMStudioAI, params } from './index';
-const provider = ModelProvider.LMStudio;
-const defaultBaseURL = 'http://127.0.0.1:1234/v1';
-
-testProvider({
- Runtime: LobeLMStudioAI,
- chatDebugEnv: 'DEBUG_LMSTUDIO_CHAT_COMPLETION',
- chatModel: 'deepseek-r1',
- defaultBaseURL,
- provider,
- test: {
- skipAPICall: true,
- },
-});
-
describe('LobeLMStudioAI - custom features', () => {
let instance: InstanceType<typeof LobeLMStudioAI>;
diff --git a/packages/model-runtime/src/providers/mistral/index.test.ts b/packages/model-runtime/src/providers/mistral/index.test.ts
index 3b6e9b429f3..7223a70bafc 100644
--- a/packages/model-runtime/src/providers/mistral/index.test.ts
+++ b/packages/model-runtime/src/providers/mistral/index.test.ts
@@ -2,20 +2,8 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { LobeOpenAICompatibleRuntime } from '../../core/BaseAI';
-import { testProvider } from '../../providerTestUtils';
import { LobeMistralAI, params } from './index';
-testProvider({
- provider: 'mistral',
- defaultBaseURL: 'https://api.mistral.ai/v1',
- chatModel: 'open-mistral-7b',
- Runtime: LobeMistralAI,
- chatDebugEnv: 'DEBUG_MISTRAL_CHAT_COMPLETION',
- test: {
- skipAPICall: true, // Mistral has custom payload handling (excludeUsage, temperature normalization)
- },
-});
-
// Mock the console.error to avoid polluting test output
vi.spyOn(console, 'error').mockImplementation(() => {});
diff --git a/packages/model-runtime/src/providers/modelscope/index.test.ts b/packages/model-runtime/src/providers/modelscope/index.test.ts
index 75b9c53714e..1b91d39500d 100644
--- a/packages/model-runtime/src/providers/modelscope/index.test.ts
+++ b/packages/model-runtime/src/providers/modelscope/index.test.ts
@@ -2,7 +2,6 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import type { ModelScopeModelCard } from './index';
import { LobeModelScopeAI, params } from './index';
@@ -15,18 +14,6 @@ vi.mock('@lobechat/business-model-bank/model-config', () => ({
const provider = ModelProvider.ModelScope;
const defaultBaseURL = 'https://api-inference.modelscope.cn/v1';
-// Basic provider tests
-testProvider({
- Runtime: LobeModelScopeAI,
- provider,
- defaultBaseURL,
- chatDebugEnv: 'DEBUG_MODELSCOPE_CHAT_COMPLETION',
- chatModel: 'qwen2-7b-instruct',
- test: {
- skipAPICall: true,
- },
-});
-
// Custom feature tests
describe('LobeModelScopeAI - custom features', () => {
describe('params export', () => {
diff --git a/packages/model-runtime/src/providers/nebius/index.test.ts b/packages/model-runtime/src/providers/nebius/index.test.ts
index 577e4f5b363..0e858cd73e1 100644
--- a/packages/model-runtime/src/providers/nebius/index.test.ts
+++ b/packages/model-runtime/src/providers/nebius/index.test.ts
@@ -2,23 +2,8 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import { LobeNebiusAI, params } from './index';
-const provider = ModelProvider.Nebius;
-const defaultBaseURL = 'https://api.studio.nebius.com/v1';
-
-testProvider({
- Runtime: LobeNebiusAI,
- chatDebugEnv: 'DEBUG_NEBIUS_CHAT_COMPLETION',
- chatModel: 'meta/llama-3.1-8b-instruct',
- defaultBaseURL,
- provider,
- test: {
- skipAPICall: true,
- },
-});
-
describe('LobeNebiusAI - custom features', () => {
let instance: InstanceType<typeof LobeNebiusAI>;
diff --git a/packages/model-runtime/src/providers/ollamacloud/index.test.ts b/packages/model-runtime/src/providers/ollamacloud/index.test.ts
index a3cbabdf114..e3115cb047f 100644
--- a/packages/model-runtime/src/providers/ollamacloud/index.test.ts
+++ b/packages/model-runtime/src/providers/ollamacloud/index.test.ts
@@ -2,7 +2,6 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import { LobeOllamaCloudAI, params } from './index';
const loadModelsMock = vi.hoisted(() => vi.fn().mockResolvedValue([]));
@@ -11,21 +10,6 @@ vi.mock('@lobechat/business-model-bank/model-config', () => ({
loadModels: loadModelsMock,
}));
-// Basic provider tests
-testProvider({
- Runtime: LobeOllamaCloudAI,
- bizErrorType: 'ProviderBizError',
- chatDebugEnv: 'DEBUG_OLLAMA_CLOUD_CHAT_COMPLETION',
- chatModel: 'llama3.2',
- defaultBaseURL: 'https://ollama.com/v1',
- invalidErrorType: 'InvalidProviderAPIKey',
- provider: ModelProvider.OllamaCloud,
- test: {
- skipAPICall: true,
- skipErrorHandle: true,
- },
-});
-
// Custom feature tests
describe('LobeOllamaCloudAI - custom features', () => {
beforeEach(() => {
diff --git a/packages/model-runtime/src/providers/openrouter/index.test.ts b/packages/model-runtime/src/providers/openrouter/index.test.ts
index 4693a868fc2..14a761b99c0 100644
--- a/packages/model-runtime/src/providers/openrouter/index.test.ts
+++ b/packages/model-runtime/src/providers/openrouter/index.test.ts
@@ -2,7 +2,6 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { LobeOpenAICompatibleRuntime } from '../../core/BaseAI';
-import { testProvider } from '../../providerTestUtils';
import { LobeOpenRouterAI, params } from './index';
const loadModelsMock = vi.hoisted(() => vi.fn().mockResolvedValue([]));
@@ -11,20 +10,6 @@ vi.mock('@lobechat/business-model-bank/model-config', () => ({
loadModels: loadModelsMock,
}));
-const provider = 'openrouter';
-const defaultBaseURL = 'https://openrouter.ai/api/v1';
-
-testProvider({
- provider,
- defaultBaseURL,
- chatModel: 'mistralai/mistral-7b-instruct:free',
- Runtime: LobeOpenRouterAI,
- chatDebugEnv: 'DEBUG_OPENROUTER_CHAT_COMPLETION',
- test: {
- skipAPICall: true,
- },
-});
-
// Mock the console.error to avoid polluting test output
vi.spyOn(console, 'error').mockImplementation(() => {});
diff --git a/packages/model-runtime/src/providers/qiniu/index.test.ts b/packages/model-runtime/src/providers/qiniu/index.test.ts
index 25a02eb2d8c..8bec8f696c0 100644
--- a/packages/model-runtime/src/providers/qiniu/index.test.ts
+++ b/packages/model-runtime/src/providers/qiniu/index.test.ts
@@ -2,26 +2,8 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import { LobeQiniuAI, params } from './index';
-const provider = ModelProvider.Qiniu;
-const defaultBaseURL = 'https://openai.qiniu.com/v1';
-
-testProvider({
- Runtime: LobeQiniuAI,
- provider,
- defaultBaseURL,
- chatDebugEnv: 'DEBUG_QINIU_CHAT_COMPLETION',
- chatModel: 'deepseek-r1',
- invalidErrorType: 'InvalidProviderAPIKey',
- bizErrorType: 'ProviderBizError',
- test: {
- skipAPICall: true,
- skipErrorHandle: true,
- },
-});
-
describe('LobeQiniuAI - custom features', () => {
let instance: InstanceType<typeof LobeQiniuAI>;
diff --git a/packages/model-runtime/src/providers/search1api/index.test.ts b/packages/model-runtime/src/providers/search1api/index.test.ts
index def6154c41e..2d63259d660 100644
--- a/packages/model-runtime/src/providers/search1api/index.test.ts
+++ b/packages/model-runtime/src/providers/search1api/index.test.ts
@@ -2,17 +2,8 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import type { LobeOpenAICompatibleRuntime } from '../../core/BaseAI';
-import { testProvider } from '../../providerTestUtils';
import { LobeSearch1API, params } from './index';
-testProvider({
- provider: 'search1api',
- defaultBaseURL: 'https://api.search1api.com/v1',
- chatModel: 'gpt-4o-mini',
- Runtime: LobeSearch1API,
- chatDebugEnv: 'DEBUG_SEARCH1API_CHAT_COMPLETION',
-});
-
// Mock the console.error to avoid polluting test output
vi.spyOn(console, 'error').mockImplementation(() => {});
diff --git a/packages/model-runtime/src/providers/stepfun/index.test.ts b/packages/model-runtime/src/providers/stepfun/index.test.ts
index 1cef0d0986d..9504f42bf19 100644
--- a/packages/model-runtime/src/providers/stepfun/index.test.ts
+++ b/packages/model-runtime/src/providers/stepfun/index.test.ts
@@ -2,23 +2,8 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import { LobeStepfunAI, params } from './index';
-const provider = ModelProvider.Stepfun;
-const defaultBaseURL = 'https://api.stepfun.com/v1';
-
-testProvider({
- Runtime: LobeStepfunAI,
- chatDebugEnv: 'DEBUG_STEPFUN_CHAT_COMPLETION',
- chatModel: 'stepfun',
- defaultBaseURL,
- provider,
- test: {
- skipAPICall: true,
- },
-});
-
describe('LobeStepfunAI - custom features', () => {
let instance: InstanceType<typeof LobeStepfunAI>;
diff --git a/packages/model-runtime/src/providers/tencentcloud/index.test.ts b/packages/model-runtime/src/providers/tencentcloud/index.test.ts
index dc36e1e8b89..a4576403d95 100644
--- a/packages/model-runtime/src/providers/tencentcloud/index.test.ts
+++ b/packages/model-runtime/src/providers/tencentcloud/index.test.ts
@@ -2,28 +2,12 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import type { TencentCloudModelCard } from './index';
-import { LobeTencentCloudAI, params } from './index';
+import { params } from './index';
const provider = ModelProvider.TencentCloud;
const defaultBaseURL = 'https://api.lkeap.cloud.tencent.com/v1';
-// Basic provider tests
-testProvider({
- Runtime: LobeTencentCloudAI,
- bizErrorType: 'ProviderBizError',
- chatDebugEnv: 'DEBUG_TENCENT_CLOUD_CHAT_COMPLETION',
- chatModel: 'DeepSeek-R1',
- defaultBaseURL,
- invalidErrorType: 'InvalidProviderAPIKey',
- provider,
- test: {
- skipAPICall: true,
- skipErrorHandle: true,
- },
-});
-
// Custom feature tests
describe('LobeTencentCloudAI - custom features', () => {
describe('params export', () => {
diff --git a/packages/model-runtime/src/providers/togetherai/index.test.ts b/packages/model-runtime/src/providers/togetherai/index.test.ts
index 2b182b78d22..682b5892e24 100644
--- a/packages/model-runtime/src/providers/togetherai/index.test.ts
+++ b/packages/model-runtime/src/providers/togetherai/index.test.ts
@@ -2,28 +2,12 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import type { TogetherAIModel } from './index';
-import { LobeTogetherAI, params } from './index';
+import { params } from './index';
const provider = ModelProvider.TogetherAI;
const defaultBaseURL = 'https://api.together.xyz/v1';
-// Basic provider tests
-testProvider({
- Runtime: LobeTogetherAI,
- bizErrorType: 'ProviderBizError',
- chatDebugEnv: 'DEBUG_TOGETHERAI_CHAT_COMPLETION',
- chatModel: 'mistralai/mistral-7b-instruct:free',
- defaultBaseURL,
- invalidErrorType: 'InvalidProviderAPIKey',
- provider,
- test: {
- skipAPICall: true,
- skipErrorHandle: true,
- },
-});
-
// Custom feature tests
describe('LobeTogetherAI - custom features', () => {
describe('params export', () => {
diff --git a/packages/model-runtime/src/providers/unsloth/index.test.ts b/packages/model-runtime/src/providers/unsloth/index.test.ts
index 79dab20872a..7108106311e 100644
--- a/packages/model-runtime/src/providers/unsloth/index.test.ts
+++ b/packages/model-runtime/src/providers/unsloth/index.test.ts
@@ -3,23 +3,10 @@ import { ModelProvider } from 'model-bank';
import OpenAI from 'openai';
import { describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
-import { LobeUnslothAI, params } from './index';
+import { params } from './index';
-const provider = ModelProvider.Unsloth;
const defaultBaseURL = 'http://127.0.0.1:8888/v1';
-testProvider({
- Runtime: LobeUnslothAI,
- chatDebugEnv: 'DEBUG_UNSLOTH_CHAT_COMPLETION',
- chatModel: 'unsloth/Qwen3-1.7B-GGUF',
- defaultBaseURL,
- provider,
- test: {
- skipAPICall: true,
- },
-});
-
describe('LobeUnslothAI - custom features', () => {
it('discovers loaded model abilities from server props without a catalog ID match', async () => {
const client = new OpenAI({
diff --git a/packages/model-runtime/src/providers/v0/index.test.ts b/packages/model-runtime/src/providers/v0/index.test.ts
index 65f09c82505..11409c20a8f 100644
--- a/packages/model-runtime/src/providers/v0/index.test.ts
+++ b/packages/model-runtime/src/providers/v0/index.test.ts
@@ -2,7 +2,6 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import { LobeV0AI, params } from './index';
const loadModelsMock = vi.hoisted(() => vi.fn().mockResolvedValue([]));
@@ -11,20 +10,6 @@ vi.mock('@lobechat/business-model-bank/model-config', () => ({
loadModels: loadModelsMock,
}));
-testProvider({
- Runtime: LobeV0AI,
- bizErrorType: 'ProviderBizError',
- chatDebugEnv: 'DEBUG_V0_CHAT_COMPLETION',
- chatModel: 'gpt-4o',
- defaultBaseURL: 'https://api.v0.dev/v1',
- invalidErrorType: 'InvalidProviderAPIKey',
- provider: ModelProvider.V0,
- test: {
- skipAPICall: true,
- skipErrorHandle: true,
- },
-});
-
describe('LobeV0AI - custom features', () => {
let instance: InstanceType<typeof LobeV0AI>;
diff --git a/packages/model-runtime/src/providers/vercelaigateway/index.test.ts b/packages/model-runtime/src/providers/vercelaigateway/index.test.ts
index 5ce74a1daa5..3fe119441d8 100644
--- a/packages/model-runtime/src/providers/vercelaigateway/index.test.ts
+++ b/packages/model-runtime/src/providers/vercelaigateway/index.test.ts
@@ -2,24 +2,9 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import type { VercelAIGatewayModelCard } from './index';
import { formatPrice, LobeVercelAIGatewayAI, params } from './index';
-testProvider({
- Runtime: LobeVercelAIGatewayAI,
- bizErrorType: 'ProviderBizError',
- chatDebugEnv: 'DEBUG_VERCELAIGATEWAY_CHAT_COMPLETION',
- chatModel: 'gpt-4o',
- defaultBaseURL: 'https://ai-gateway.vercel.sh/v1',
- invalidErrorType: 'InvalidProviderAPIKey',
- provider: ModelProvider.VercelAIGateway,
- test: {
- skipAPICall: true,
- skipErrorHandle: true,
- },
-});
-
describe('LobeVercelAIGatewayAI - custom features', () => {
let instance: InstanceType<typeof LobeVercelAIGatewayAI>;
diff --git a/packages/model-runtime/src/providers/zeroone/index.test.ts b/packages/model-runtime/src/providers/zeroone/index.test.ts
index 667c508768d..27dd694e4e4 100644
--- a/packages/model-runtime/src/providers/zeroone/index.test.ts
+++ b/packages/model-runtime/src/providers/zeroone/index.test.ts
@@ -2,7 +2,6 @@
import { ModelProvider } from 'model-bank';
import { beforeEach, describe, expect, it, vi } from 'vitest';
-import { testProvider } from '../../providerTestUtils';
import { LobeZeroOneAI, params } from './index';
const loadModelsMock = vi.hoisted(() => vi.fn().mockResolvedValue([]));
@@ -11,14 +10,6 @@ vi.mock('@lobechat/business-model-bank/model-config', () => ({
loadModels: loadModelsMock,
}));
-testProvider({
- Runtime: LobeZeroOneAI,
- chatDebugEnv: 'DEBUG_ZEROONE_CHAT_COMPLETION',
- chatModel: 'yi-34b-chat-0205',
- defaultBaseURL: 'https://api.lingyiwanwu.com/v1',
- provider: ModelProvider.ZeroOne,
-});
-
describe('LobeZeroOneAI - custom features', () => {
let instance: InstanceType<typeof LobeZeroOneAI>;
diff --git a/packages/model-runtime/src/providers/zhipu/index.test.ts b/packages/model-runtime/src/providers/zhipu/index.test.ts
index cb5af111042..6a581bf1136 100644
--- a/packages/model-runtime/src/providers/zhipu/index.test.ts
+++ b/packages/model-runtime/src/providers/zhipu/index.test.ts
@@ -2,20 +2,8 @@
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { type LobeOpenAICompatibleRuntime } from '../../core/BaseAI';
-import { testProvider } from '../../providerTestUtils';
import { LobeZhipuAI, params } from './index';
-testProvider({
- provider: 'zhipu',
- defaultBaseURL: 'https://open.bigmodel.cn/api/paas/v4',
- chatModel: 'glm-4',
- Runtime: LobeZhipuAI,
- chatDebugEnv: 'DEBUG_ZHIPU_CHAT_COMPLETION',
- test: {
- skipAPICall: true, // Skip because Zhipu has custom handlePayload that normalizes temperature
- },
-});
-
vi.mock('@lobechat/business-model-bank/model-config', () => ({
loadModels: vi.fn().mockResolvedValue([]),
}));
diff --git a/packages/prompts/src/prompts/fileSystem/formatCommandResult.test.ts b/packages/prompts/src/prompts/fileSystem/formatCommandResult.test.ts
index 373ec254c95..323889f5237 100644
--- a/packages/prompts/src/prompts/fileSystem/formatCommandResult.test.ts
+++ b/packages/prompts/src/prompts/fileSystem/formatCommandResult.test.ts
@@ -134,18 +134,6 @@ describe('formatCommandResult', () => {
`);
});
- it('should suppress the Exit code line when exitCode is 0', () => {
- const result = formatCommandResult({
- exitCode: 0,
- success: true,
- });
- expect(result).toMatchInlineSnapshot(`
- "Command completed successfully.
-
- (no output)"
- `);
- });
-
it('should treat shell id with exitCode 0 as completed', () => {
const result = formatCommandResult({
exitCode: 0,
diff --git a/packages/utils/src/base64.test.ts b/packages/utils/src/base64.test.ts
index 4a9d30b2a5d..feb502477d5 100644
--- a/packages/utils/src/base64.test.ts
+++ b/packages/utils/src/base64.test.ts
@@ -29,14 +29,6 @@ describe('base64 utilities', () => {
// Restore btoa
global.btoa = originalBtoa;
});
-
- it('should handle special characters', () => {
- const input = 'test@123:password';
- const result = encodeToBase64(input);
-
- // Expected base64 for 'test@123:password' is 'dGVzdEAxMjM6cGFzc3dvcmQ='
- expect(result).toBe(Buffer.from(input, 'utf8').toString('base64'));
- });
});
describe('decodeFromBase64', () => {
diff --git a/packages/utils/src/format.test.ts b/packages/utils/src/format.test.ts
index 6d8c9d42325..b98df68d7dc 100644
--- a/packages/utils/src/format.test.ts
+++ b/packages/utils/src/format.test.ts
@@ -100,11 +100,6 @@ describe('format', () => {
expect(formatTime(7200)).toBe('2.00 h');
});
- it('should handle edge cases', () => {
- expect(formatTime(0)).toBe('0.0 s');
- expect(formatTime(59.99)).toBe('60.0 s');
- expect(formatTime(3599.99)).toBe('60.0 min');
- });
it('should handle edge cases', () => {
expect(formatTime(0)).toBe('0.0 s');
expect(formatTime(59.99)).toBe('60.0 s');
diff --git a/packages/utils/src/storeDebug.test.ts b/packages/utils/src/storeDebug.test.ts
index 080a2284238..6985b7620ee 100644
--- a/packages/utils/src/storeDebug.test.ts
+++ b/packages/utils/src/storeDebug.test.ts
@@ -4,12 +4,6 @@ import { setNamespace } from './storeDebug';
describe('storeDebug utilities', () => {
describe('setNamespace', () => {
- it('should create a namespaced action creator', () => {
- const createAction = setNamespace('user');
-
- expect(typeof createAction).toBe('function');
- });
-
it('should return string action type when no payload provided', () => {
const createAction = setNamespace('user');
const actionType = createAction('login');
@@ -92,33 +86,6 @@ describe('storeDebug utilities', () => {
expect(falseAction).toBe('data/disable');
});
- it('should handle complex nested object payload', () => {
- const createAction = setNamespace('app');
- const complexPayload = {
- user: {
- id: 123,
- profile: {
- name: 'John Doe',
- settings: {
- theme: 'dark',
- notifications: true,
- },
- },
- },
- metadata: {
- timestamp: Date.now(),
- source: 'api',
- },
- };
-
- const action = createAction('userUpdate', complexPayload);
-
- expect(action).toEqual({
- type: 'app/userUpdate',
- payload: complexPayload,
- });
- });
-
it('should create unique namespaces for different instances', () => {
const userActions = setNamespace('user');
const postActions = setNamespace('post');
@@ -129,24 +96,5 @@ describe('storeDebug utilities', () => {
expect(userLogin).toBe('user/login');
expect(postCreate).toBe('post/create');
});
-
- it('should handle special characters in namespace and type', () => {
- const createAction = setNamespace('my-feature_v2');
- const actionType = createAction('save-data_with-id');
-
- expect(actionType).toBe('my-feature_v2/save-data_with-id');
- });
-
- it('should maintain type consistency across calls', () => {
- const createAction = setNamespace('counter');
-
- // Multiple calls should work consistently
- const increment1 = createAction('increment');
- const increment2 = createAction('increment');
-
- expect(increment1).toBe('counter/increment');
- expect(increment2).toBe('counter/increment');
- expect(increment1).toBe(increment2);
- });
});
});
diff --git a/packages/utils/src/url.test.ts b/packages/utils/src/url.test.ts
index 85823e47391..a46c9ee9313 100644
--- a/packages/utils/src/url.test.ts
+++ b/packages/utils/src/url.test.ts
@@ -32,11 +32,6 @@ describe('pathString', () => {
expect(result).toBe('/home');
});
- it('should handle absolute path', () => {
- const result = pathString('/home');
- expect(result).toBe('/home');
- });
-
it('should handle path with protocol', () => {
const result = pathString('https://www.example.com/home');
expect(result).toBe('https://www.example.com/home');
@@ -59,26 +54,6 @@ describe('pathString', () => {
});
describe('inferContentTypeFromImageUrl', () => {
- it('should return correct MIME type for jpg images', () => {
- const result = inferContentTypeFromImageUrl('https://example.com/image.jpg');
- expect(result).toBe('image/jpeg');
- });
-
- it('should return correct MIME type for png images', () => {
- const result = inferContentTypeFromImageUrl('https://example.com/image.png');
- expect(result).toBe('image/png');
- });
-
- it('should return correct MIME type for webp images', () => {
- const result = inferContentTypeFromImageUrl('https://example.com/image.webp');
- expect(result).toBe('image/webp');
- });
-
- it('should return correct MIME type for gif images', () => {
- const result = inferContentTypeFromImageUrl('https://example.com/image.gif');
- expect(result).toBe('image/gif');
- });
-
it('should handle uppercase extensions', () => {
const result = inferContentTypeFromImageUrl('https://example.com/image.JPG');
expect(result).toBe('image/jpeg');
@@ -123,26 +98,6 @@ describe('inferContentTypeFromImageUrl', () => {
expect(result).toBe('image/jpeg');
});
- it('should handle BMP format', () => {
- const result = inferContentTypeFromImageUrl('https://example.com/image.bmp');
- expect(result).toBe('image/bmp');
- });
-
- it('should handle TIFF format', () => {
- const result = inferContentTypeFromImageUrl('https://example.com/image.tiff');
- expect(result).toBe('image/tiff');
- });
-
- it('should handle TIF format', () => {
- const result = inferContentTypeFromImageUrl('https://example.com/image.tif');
- expect(result).toBe('image/tiff');
- });
-
- it('should handle SVG format', () => {
- const result = inferContentTypeFromImageUrl('https://example.com/image.svg');
- expect(result).toBe('image/svg+xml');
- });
-
it('should throw error for invalid URLs', () => {
expect(() => {
inferContentTypeFromImageUrl('invalid-url');
@@ -263,36 +218,6 @@ describe('inferContentTypeFromImageUrl', () => {
});
describe('inferFileExtensionFromImageUrl', () => {
- it('should return jpg extension', () => {
- const result = inferFileExtensionFromImageUrl('https://example.com/image.jpg');
- expect(result).toBe('jpg');
- });
-
- it('should return png extension', () => {
- const result = inferFileExtensionFromImageUrl('https://example.com/image.png');
- expect(result).toBe('png');
- });
-
- it('should return webp extension', () => {
- const result = inferFileExtensionFromImageUrl('https://example.com/image.webp');
- expect(result).toBe('webp');
- });
-
- it('should handle jpeg extension', () => {
- const result = inferFileExtensionFromImageUrl('https://example.com/image.jpeg');
- expect(result).toBe('jpeg');
- });
-
- it('should handle gif extension', () => {
- const result = inferFileExtensionFromImageUrl('https://example.com/image.gif');
- expect(result).toBe('gif');
- });
-
- it('should handle svg extension', () => {
- const result = inferFileExtensionFromImageUrl('https://example.com/image.svg');
- expect(result).toBe('svg');
- });
-
it('should handle uppercase extensions and convert to lowercase', () => {
const result = inferFileExtensionFromImageUrl('https://example.com/image.PNG');
expect(result).toBe('png');