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: simplify redundant business test cases (#22212)

Innei6a575cf7fdb9
diff --git a/.github/scripts/bundle-size-gate.test.cjs b/.github/scripts/bundle-size-gate.test.cjs
index 1cd3f6031f4..c6c093e7b29 100644
--- a/.github/scripts/bundle-size-gate.test.cjs
+++ b/.github/scripts/bundle-size-gate.test.cjs
@@ -129,26 +129,6 @@ test('Vite JS output file count over the baseline percentage limit fails the gat
assert.match(result.stderr, /Vite JS output file count increases by more than 5%/);
});
-test('Vite JS output file count at the baseline percentage limit passes the gate', () => {
- const result = runCheck({
- baselineGraphCount: 10,
- baselineJsTotal: 100,
- currentGraphCount: 10,
- currentJsTotal: 105,
- });
- assert.equal(result.status, 0);
-});
-
-test('reachable graph count increase alone does not fail the gate', () => {
- const result = runCheck({
- baselineGraphCount: 10,
- baselineJsTotal: 100,
- currentGraphCount: 20,
- currentJsTotal: 100,
- });
- assert.equal(result.status, 0);
-});
-
test('a passing gate states the entry count and the largest delta in the heading', () => {
const result = runCheck({
baselineGraphCount: 10,
diff --git a/apps/desktop/src/main/core/browser/__tests__/BrowserManager.test.ts b/apps/desktop/src/main/core/browser/__tests__/BrowserManager.test.ts
index 88d95983204..c1955192428 100644
--- a/apps/desktop/src/main/core/browser/__tests__/BrowserManager.test.ts
+++ b/apps/desktop/src/main/core/browser/__tests__/BrowserManager.test.ts
@@ -120,10 +120,6 @@ describe('BrowserManager', () => {
it('should initialize with empty browsers Map', () => {
expect(manager.browsers.size).toBe(0);
});
-
- it('should store app reference', () => {
- expect(manager.app).toBe(mockApp);
- });
});
describe('getMainWindow', () => {
diff --git a/apps/desktop/src/main/core/infrastructure/__tests__/ProtocolManager.test.ts b/apps/desktop/src/main/core/infrastructure/__tests__/ProtocolManager.test.ts
index f50eeed497c..d8fd7b5c5ae 100644
--- a/apps/desktop/src/main/core/infrastructure/__tests__/ProtocolManager.test.ts
+++ b/apps/desktop/src/main/core/infrastructure/__tests__/ProtocolManager.test.ts
@@ -125,12 +125,6 @@ describe('ProtocolManager', () => {
});
describe('protocol registration', () => {
- it('should use simple registration in production mode', () => {
- manager.initialize();
-
- expect(app.setAsDefaultProtocolClient).toHaveBeenCalledWith('lobehub');
- });
-
it('should use explicit parameters in development mode', async () => {
vi.doMock('@/const/env', () => ({ isDev: true }));
vi.resetModules();
diff --git a/apps/desktop/src/main/core/ui/__tests__/MenuManager.test.ts b/apps/desktop/src/main/core/ui/__tests__/MenuManager.test.ts
index ad050289fd6..6f61e77bdb7 100644
--- a/apps/desktop/src/main/core/ui/__tests__/MenuManager.test.ts
+++ b/apps/desktop/src/main/core/ui/__tests__/MenuManager.test.ts
@@ -88,12 +88,6 @@ describe('MenuManager', () => {
expect(mockBuildAndSetAppMenu).toHaveBeenCalledWith(options);
});
-
- it('should call buildAndSetAppMenu on platform implementation', () => {
- menuManager.initialize();
-
- expect(mockBuildAndSetAppMenu).toHaveBeenCalled();
- });
});
describe('showContextMenu', () => {
@@ -177,13 +171,6 @@ describe('MenuManager', () => {
expect(mockBuildTrayMenu).toHaveBeenCalled();
expect(result).toBe(mockMenu);
});
-
- it('should return Menu instance', () => {
- const result = menuManager.buildTrayMenu();
-
- expect(result).toBeDefined();
- expect(result).toBe(mockMenu);
- });
});
describe('refreshMenus', () => {
@@ -202,12 +189,6 @@ describe('MenuManager', () => {
expect(mockRefresh).toHaveBeenCalledWith(options);
expect(result).toEqual({ success: true });
});
-
- it('should call refresh on platform implementation', () => {
- menuManager.refreshMenus();
-
- expect(mockRefresh).toHaveBeenCalled();
- });
});
describe('rebuildAppMenu', () => {
@@ -226,12 +207,6 @@ describe('MenuManager', () => {
expect(mockBuildAndSetAppMenu).toHaveBeenCalledWith(options);
expect(result).toEqual({ success: true });
});
-
- it('should call buildAndSetAppMenu on platform implementation', () => {
- menuManager.rebuildAppMenu();
-
- expect(mockBuildAndSetAppMenu).toHaveBeenCalled();
- });
});
describe('integration tests', () => {
diff --git a/apps/desktop/src/main/menus/impls/BaseMenuPlatform.test.ts b/apps/desktop/src/main/menus/impls/BaseMenuPlatform.test.ts
index 08864194f5d..9bc63e1b636 100644
--- a/apps/desktop/src/main/menus/impls/BaseMenuPlatform.test.ts
+++ b/apps/desktop/src/main/menus/impls/BaseMenuPlatform.test.ts
@@ -96,17 +96,6 @@ describe('BaseMenuPlatform', () => {
vi.useRealTimers();
});
- describe('constructor', () => {
- it('should initialize with app instance', () => {
- expect(menuPlatform['app']).toBe(mockApp);
- });
-
- it('should store app reference for subclasses', () => {
- const anotherInstance = new TestMenuPlatform(mockApp);
- expect(anotherInstance['app']).toBe(mockApp);
- });
- });
-
describe('reload confirmation', () => {
it.each([false, true])(
'preserves the requested cache behavior (ignoreCache=%s)',
diff --git a/apps/desktop/src/preload/electronApi.test.ts b/apps/desktop/src/preload/electronApi.test.ts
index f51d6004012..3bd2a6eca35 100644
--- a/apps/desktop/src/preload/electronApi.test.ts
+++ b/apps/desktop/src/preload/electronApi.test.ts
@@ -287,16 +287,6 @@ describe('setupElectronApi', () => {
expect(rendererListener).not.toHaveBeenCalled();
});
- it('should not modify the original functions', () => {
- const originalInvoke = mockInvoke;
- const originalOnStreamInvoke = mockOnStreamInvoke;
-
- setupElectronApi();
-
- expect(mockInvoke).toBe(originalInvoke);
- expect(mockOnStreamInvoke).toBe(originalOnStreamInvoke);
- });
-
it('should be callable multiple times without side effects', () => {
setupElectronApi();
setupElectronApi();
diff --git a/apps/server/src/globalConfig/parseDefaultAgent.test.ts b/apps/server/src/globalConfig/parseDefaultAgent.test.ts
index 1498ff07053..712a071cd92 100644
--- a/apps/server/src/globalConfig/parseDefaultAgent.test.ts
+++ b/apps/server/src/globalConfig/parseDefaultAgent.test.ts
@@ -71,14 +71,6 @@ describe('parseAgentConfig', () => {
expect(parseAgentConfig(envStr)).toEqual(expected);
});
- it('parses OpenAI TTS voice configuration correctly', () => {
- const envStr = 'tts.voice.openai=english-voice';
- const expected = {
- tts: { voice: { openai: 'english-voice' } },
- };
- expect(parseAgentConfig(envStr)).toEqual(expected);
- });
-
it('parses inputTemplate with special characters correctly', () => {
const envStr = 'inputTemplate="Hello, I am {name}"';
const expected = { inputTemplate: 'Hello, I am {name}' };
diff --git a/apps/server/src/routers/lambda/__tests__/integration/agentEval.integration.test.ts b/apps/server/src/routers/lambda/__tests__/integration/agentEval.integration.test.ts
index 804383d9c25..8395ef81d50 100644
--- a/apps/server/src/routers/lambda/__tests__/integration/agentEval.integration.test.ts
+++ b/apps/server/src/routers/lambda/__tests__/integration/agentEval.integration.test.ts
@@ -906,14 +906,6 @@ describe('Agent Eval Router Integration Tests', () => {
});
});
- it('should default status to idle', async () => {
- const caller = agentEvalRouter.createCaller(createTestContext(userId));
-
- const result = await caller.createRun({ datasetId });
-
- expect(result.status).toBe('idle');
- });
-
it('should throw BAD_REQUEST when dataset not found', async () => {
const caller = agentEvalRouter.createCaller(createTestContext(userId));
diff --git a/apps/server/src/routers/lambda/__tests__/message.test.ts b/apps/server/src/routers/lambda/__tests__/message.test.ts
deleted file mode 100644
index 89000b64899..00000000000
--- a/apps/server/src/routers/lambda/__tests__/message.test.ts
+++ /dev/null
@@ -1,488 +0,0 @@
-import {
- type CreateMessageParams,
- type UIChatMessage,
- type UpdateMessageRAGParams,
-} from '@lobechat/types';
-import { TRPCError } from '@trpc/server';
-import { describe, expect, it, vi } from 'vitest';
-
-import { MessageModel } from '@/database/models/message';
-import { TopicShareModel } from '@/database/models/topicShare';
-import { FileService } from '@/server/services/file';
-
-vi.mock('@/database/models/message', () => ({
- MessageModel: vi.fn(),
-}));
-
-vi.mock('@/database/models/topicShare', () => ({
- TopicShareModel: {
- findByShareIdWithAccessCheck: vi.fn(),
- },
-}));
-
-vi.mock('@/server/services/file', () => ({
- FileService: vi.fn(),
-}));
-
-vi.mock('@/database/server', () => ({
- getServerDB: vi.fn(),
-}));
-
-describe('messageRouter', () => {
- it('should handle batchCreateMessages', async () => {
- const mockBatchCreate = vi.fn().mockResolvedValue({ rowCount: 2 });
- vi.mocked(MessageModel).mockImplementation(function () {
- return {
- batchCreate: mockBatchCreate,
- } as any;
- });
-
- const input = [
- {
- id: '1',
- role: 'user',
- content: 'test',
- sessionId: 'session1',
- createdAt: new Date(),
- updatedAt: new Date(),
- agentId: 'agent1',
- clientId: 'client1',
- parentId: null,
- quotaId: null,
- model: null,
- provider: null,
- topicId: null,
- error: null,
- favorite: false,
- observationId: null,
- reasoning: null,
- pluginState: null,
- translate: null,
- tts: null,
- search: null,
- threadId: null,
- tools: null,
- traceId: null,
- userId: 'user1',
- } as any,
- ];
-
- const ctx = {
- messageModel: new MessageModel({} as any, 'user1'),
- };
-
- const result = await ctx.messageModel.batchCreate(input);
-
- expect(mockBatchCreate).toHaveBeenCalledWith(input);
- expect(result.rowCount).toBe(2);
- });
-
- it('should handle count', async () => {
- const mockCount = vi.fn().mockResolvedValue(5);
- vi.mocked(MessageModel).mockImplementation(function () {
- return {
- count: mockCount,
- } as any;
- });
-
- const input = { startDate: '2024-01-01' };
- const ctx = {
- messageModel: new MessageModel({} as any, 'user1'),
- };
-
- const result = await ctx.messageModel.count(input);
-
- expect(mockCount).toHaveBeenCalledWith(input);
- expect(result).toBe(5);
- });
-
- it('should handle createMessage', async () => {
- const mockCreate = vi.fn().mockResolvedValue({ id: 'msg1' });
- vi.mocked(MessageModel).mockImplementation(function () {
- return {
- create: mockCreate,
- } as any;
- });
-
- const input: CreateMessageParams = {
- content: 'test',
- role: 'user',
- sessionId: 'session1',
- };
-
- const ctx = {
- messageModel: new MessageModel({} as any, 'user1'),
- };
-
- const result = await ctx.messageModel.create(input);
-
- expect(mockCreate).toHaveBeenCalledWith(input);
- expect(result.id).toBe('msg1');
- });
-
- it('should handle getMessages', async () => {
- const mockQuery = vi.fn().mockResolvedValue([{ id: 'msg1' }]);
- const mockGetFullFileUrl = vi.fn().mockImplementation(function (
- path: string | null,
- file: { fileType: string },
- ) {
- return Promise.resolve('url');
- });
-
- vi.mocked(MessageModel).mockImplementation(function () {
- return {
- query: mockQuery,
- } as any;
- });
-
- vi.mocked(FileService).mockImplementation(function () {
- return {
- getFullFileUrl: mockGetFullFileUrl,
- } as any;
- });
-
- const input = { sessionId: 'session1' };
- const ctx = {
- messageModel: new MessageModel({} as any, 'user1'),
- fileService: new FileService({} as any, 'user1'),
- userId: 'user1',
- };
-
- const result = await ctx.messageModel.query(input, {
- postProcessUrl: mockGetFullFileUrl,
- });
-
- expect(mockQuery).toHaveBeenCalledWith(input, expect.any(Object));
- expect(result).toEqual([{ id: 'msg1' }]);
- });
-
- it('should handle getAllMessages', async () => {
- const mockQueryAll = vi.fn().mockResolvedValue([
- {
- id: 'msg1',
- } as UIChatMessage,
- ]);
- vi.mocked(MessageModel).mockImplementation(function () {
- return {
- queryAll: mockQueryAll,
- } as any;
- });
-
- const ctx = {
- messageModel: new MessageModel({} as any, 'user1'),
- };
-
- const result = await ctx.messageModel.queryAll();
-
- expect(mockQueryAll).toHaveBeenCalled();
- expect(result).toEqual([{ id: 'msg1' }]);
- });
-
- it('should handle removeMessage', async () => {
- const mockDelete = vi.fn().mockResolvedValue(undefined);
- vi.mocked(MessageModel).mockImplementation(function () {
- return {
- deleteMessage: mockDelete,
- } as any;
- });
-
- const input = { id: 'msg1' };
- const ctx = {
- messageModel: new MessageModel({} as any, 'user1'),
- };
-
- await ctx.messageModel.deleteMessage(input.id);
-
- expect(mockDelete).toHaveBeenCalledWith(input.id);
- });
-
- it('should handle updateMessage', async () => {
- const mockUpdate = vi.fn().mockResolvedValue({ success: true });
- vi.mocked(MessageModel).mockImplementation(function () {
- return {
- update: mockUpdate,
- } as any;
- });
-
- const input = { id: 'msg1', value: { content: 'updated' } };
- const ctx = {
- messageModel: new MessageModel({} as any, 'user1'),
- };
-
- const result = await ctx.messageModel.update(input.id, input.value);
-
- expect(mockUpdate).toHaveBeenCalledWith(input.id, input.value);
- expect(result).toEqual({ success: true });
- });
-
- it('should handle updateMessageRAG', async () => {
- const mockUpdateRAG = vi.fn().mockResolvedValue(undefined);
- vi.mocked(MessageModel).mockImplementation(function () {
- return {
- updateMessageRAG: mockUpdateRAG,
- } as any;
- });
-
- const input = {
- id: 'msg1',
- value: { ragQueryId: 'q1', fileChunks: [{ id: 'c1', similarity: 0.9 }] },
- } as {
- id: string;
- value: UpdateMessageRAGParams;
- };
-
- const ctx = {
- messageModel: new MessageModel({} as any, 'user1'),
- };
-
- await ctx.messageModel.updateMessageRAG(input.id, input.value);
-
- expect(mockUpdateRAG).toHaveBeenCalledWith('msg1', {
- ragQueryId: 'q1',
- fileChunks: [{ id: 'c1', similarity: 0.9 }],
- });
- });
-
- describe('agentId support', () => {
- it('should handle createMessage with agentId', async () => {
- const mockCreate = vi.fn().mockResolvedValue({ id: 'msg1' });
- vi.mocked(MessageModel).mockImplementation(function () {
- return {
- create: mockCreate,
- } as any;
- });
-
- const input: CreateMessageParams = {
- agentId: 'agent1',
- content: 'test',
- role: 'user',
- sessionId: 'session1',
- };
-
- const ctx = {
- messageModel: new MessageModel({} as any, 'user1'),
- };
-
- const result = await ctx.messageModel.create(input);
-
- expect(mockCreate).toHaveBeenCalledWith(input);
- expect(result.id).toBe('msg1');
- });
-
- it('should handle getMessages with agentId', async () => {
- const mockQuery = vi.fn().mockResolvedValue([{ id: 'msg1' }]);
- const mockGetFullFileUrl = vi.fn().mockImplementation(function (path: string | null) {
- return Promise.resolve('url');
- });
-
- vi.mocked(MessageModel).mockImplementation(function () {
- return {
- query: mockQuery,
- } as any;
- });
-
- vi.mocked(FileService).mockImplementation(function () {
- return {
- getFullFileUrl: mockGetFullFileUrl,
- } as any;
- });
-
- const input = { agentId: 'agent1', sessionId: 'session1' };
- const ctx = {
- messageModel: new MessageModel({} as any, 'user1'),
- fileService: new FileService({} as any, 'user1'),
- };
-
- const result = await ctx.messageModel.query(input, {
- postProcessUrl: mockGetFullFileUrl,
- });
-
- expect(mockQuery).toHaveBeenCalledWith(input, expect.any(Object));
- expect(result).toEqual([{ id: 'msg1' }]);
- });
-
- it('should handle getMessages with agentId only (no sessionId)', async () => {
- const mockQuery = vi.fn().mockResolvedValue([{ id: 'msg1' }]);
- const mockGetFullFileUrl = vi.fn().mockImplementation(function (path: string | null) {
- return Promise.resolve('url');
- });
-
- vi.mocked(MessageModel).mockImplementation(function () {
- return {
- query: mockQuery,
- } as any;
- });
-
- const input = { agentId: 'agent1' };
- const ctx = {
- messageModel: new MessageModel({} as any, 'user1'),
- };
-
- const result = await ctx.messageModel.query(input, {
- postProcessUrl: mockGetFullFileUrl,
- });
-
- expect(mockQuery).toHaveBeenCalledWith(input, expect.any(Object));
- expect(result).toEqual([{ id: 'msg1' }]);
- });
-
- it('should handle batchDeleteByAgentId', async () => {
- const mockBatchDeleteByAgentId = vi.fn().mockResolvedValue({ rowCount: 5 });
- vi.mocked(MessageModel).mockImplementation(function () {
- return {
- batchDeleteByAgentId: mockBatchDeleteByAgentId,
- } as any;
- });
-
- const ctx = {
- messageModel: new MessageModel({} as any, 'user1'),
- };
-
- const result = await ctx.messageModel.batchDeleteByAgentId('agent1');
-
- expect(mockBatchDeleteByAgentId).toHaveBeenCalledWith('agent1');
- expect(result.rowCount).toBe(5);
- });
- });
-
- describe('topicShareId support', () => {
- it('should get messages via topicShareId for link share', async () => {
- const mockShare = {
- visibility: 'link',
- ownerId: 'owner-user',
- shareId: 'share-123',
- topicId: 'topic-1',
- };
-
- const mockMessages = [
- { id: 'msg1', content: 'Hello', role: 'user' },
- { id: 'msg2', content: 'Hi there', role: 'assistant' },
- ];
-
- const mockQuery = vi.fn().mockResolvedValue(mockMessages);
- const mockGetFullFileUrl = vi.fn().mockImplementation(function (path: string) {
- return `https://cdn/${path}`;
- });
-
- vi.mocked(TopicShareModel.findByShareIdWithAccessCheck).mockResolvedValue(mockShare as any);
- vi.mocked(MessageModel).mockImplementation(function () {
- return {
- query: mockQuery,
- } as any;
- });
- vi.mocked(FileService).mockImplementation(function () {
- return {
- getFullFileUrl: mockGetFullFileUrl,
- } as any;
- });
-
- // Simulate the router logic
- const share = await TopicShareModel.findByShareIdWithAccessCheck(
- {} as any,
- 'share-123',
- undefined,
- );
-
- expect(share).toBeDefined();
- expect(share.topicId).toBe('topic-1');
- expect(share.ownerId).toBe('owner-user');
-
- // Create model using owner's id
- const messageModel = new MessageModel({} as any, share.ownerId);
- const result = await messageModel.query(
- { topicId: share.topicId },
- { postProcessUrl: mockGetFullFileUrl },
- );
-
- expect(result).toEqual(mockMessages);
- });
-
- it('should allow owner to access private share messages', async () => {
- const mockShare = {
- visibility: 'private',
- ownerId: 'owner-user',
- shareId: 'private-share',
- topicId: 'topic-private',
- };
-
- vi.mocked(TopicShareModel.findByShareIdWithAccessCheck).mockResolvedValue(mockShare as any);
-
- const share = await TopicShareModel.findByShareIdWithAccessCheck(
- {} as any,
- 'private-share',
- 'owner-user', // Owner accessing
- );
-
- expect(share).toBeDefined();
- expect(share.visibility).toBe('private');
- });
-
- it('should throw FORBIDDEN for private share accessed by non-owner', async () => {
- vi.mocked(TopicShareModel.findByShareIdWithAccessCheck).mockRejectedValue(
- new TRPCError({ code: 'FORBIDDEN', message: 'This share is private' }),
- );
-
- await expect(
- TopicShareModel.findByShareIdWithAccessCheck({} as any, 'private-share', 'other-user'),
- ).rejects.toThrow(TRPCError);
-
- try {
- await TopicShareModel.findByShareIdWithAccessCheck(
- {} as any,
- 'private-share',
- 'other-user',
- );
- } catch (error) {
- expect((error as TRPCError).code).toBe('FORBIDDEN');
- }
- });
-
- it('should throw NOT_FOUND for non-existent share', async () => {
- vi.mocked(TopicShareModel.findByShareIdWithAccessCheck).mockRejectedValue(
- new TRPCError({ code: 'NOT_FOUND', message: 'Share not found' }),
- );
-
- await expect(
- TopicShareModel.findByShareIdWithAccessCheck({} as any, 'non-existent', 'user1'),
- ).rejects.toThrow(TRPCError);
-
- try {
- await TopicShareModel.findByShareIdWithAccessCheck({} as any, 'non-existent', 'user1');
- } catch (error) {
- expect((error as TRPCError).code).toBe('NOT_FOUND');
- }
- });
-
- it('should use owner id to query messages for shared topic', async () => {
- const mockShare = {
- visibility: 'link',
- ownerId: 'topic-owner',
- shareId: 'share-abc',
- topicId: 'shared-topic',
- };
-
- const mockQuery = vi.fn().mockResolvedValue([{ id: 'msg1' }]);
-
- vi.mocked(TopicShareModel.findByShareIdWithAccessCheck).mockResolvedValue(mockShare as any);
- vi.mocked(MessageModel).mockImplementation(function () {
- return {
- query: mockQuery,
- } as any;
- });
-
- const share = await TopicShareModel.findByShareIdWithAccessCheck(
- {} as any,
- 'share-abc',
- undefined,
- );
-
- // Verify we use the owner's id to create MessageModel
- const messageModel = new MessageModel({} as any, share.ownerId);
- await messageModel.query({ topicId: share.topicId }, {});
-
- // Verify MessageModel was instantiated with owner's id
- expect(MessageModel).toHaveBeenCalledWith({} as any, 'topic-owner');
- expect(mockQuery).toHaveBeenCalledWith({ topicId: 'shared-topic' }, {});
- });
- });
-});
diff --git a/apps/server/src/routers/lambda/__tests__/topic.test.ts b/apps/server/src/routers/lambda/__tests__/topic.test.ts
deleted file mode 100644
index 3215400ad00..00000000000
--- a/apps/server/src/routers/lambda/__tests__/topic.test.ts
+++ /dev/null
@@ -1,423 +0,0 @@
-import { describe, expect, it, vi } from 'vitest';
-
-import { TopicModel } from '@/database/models/topic';
-import { TopicShareModel } from '@/database/models/topicShare';
-import { TopicRepository } from '@/database/repositories/topic';
-
-vi.mock('@/database/models/topic', () => ({
- TopicModel: vi.fn(),
-}));
-
-vi.mock('@/database/repositories/topic', () => ({
- TopicRepository: vi.fn(),
-}));
-
-vi.mock('@/database/models/topicShare', () => ({
- TopicShareModel: vi.fn(),
-}));
-
-vi.mock('@/database/server', () => ({
- getServerDB: vi.fn(),
-}));
-
-describe('topicRouter', () => {
- it('should handle createTopic with sessionId', async () => {
- const mockCreate = vi.fn().mockResolvedValue({ id: 'topic1' });
- vi.mocked(TopicModel).mockImplementation(function () {
- return {
- create: mockCreate,
- } as any;
- });
-
- const input = {
- sessionId: 'session1',
- title: 'Test Topic',
- };
-
- const ctx = {
- topicModel: new TopicModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicModel.create(input);
-
- expect(mockCreate).toHaveBeenCalledWith(input);
- expect(result.id).toBe('topic1');
- });
-
- it('should handle getTopics with groupId', async () => {
- const mockQuery = vi
- .fn()
- .mockResolvedValue({ items: [{ id: 'topic1', title: 'Test' }], total: 1 });
- vi.mocked(TopicModel).mockImplementation(function () {
- return {
- query: mockQuery,
- } as any;
- });
-
- const input = { groupId: 'group1' };
- const ctx = {
- topicModel: new TopicModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicModel.query(input);
-
- expect(mockQuery).toHaveBeenCalledWith(input);
- expect(result).toEqual({ items: [{ id: 'topic1', title: 'Test' }], total: 1 });
- });
-
- it('should handle deleteTopic', async () => {
- const mockDelete = vi.fn().mockResolvedValue(undefined);
- vi.mocked(TopicModel).mockImplementation(function () {
- return {
- delete: mockDelete,
- } as any;
- });
-
- const ctx = {
- topicModel: new TopicModel({} as any, 'user1'),
- };
-
- await ctx.topicModel.delete('topic1');
-
- expect(mockDelete).toHaveBeenCalledWith('topic1');
- });
-
- it('should handle updateTopic', async () => {
- const mockUpdate = vi.fn().mockResolvedValue({ success: true });
- vi.mocked(TopicModel).mockImplementation(function () {
- return {
- update: mockUpdate,
- } as any;
- });
-
- const ctx = {
- topicModel: new TopicModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicModel.update('topic1', { title: 'Updated Title' });
-
- expect(mockUpdate).toHaveBeenCalledWith('topic1', { title: 'Updated Title' });
- expect(result).toEqual({ success: true });
- });
-
- it('should handle batchDelete', async () => {
- const mockBatchDelete = vi.fn().mockResolvedValue({ rowCount: 3 });
- vi.mocked(TopicModel).mockImplementation(function () {
- return {
- batchDelete: mockBatchDelete,
- } as any;
- });
-
- const ctx = {
- topicModel: new TopicModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicModel.batchDelete(['topic1', 'topic2', 'topic3']);
-
- expect(mockBatchDelete).toHaveBeenCalledWith(['topic1', 'topic2', 'topic3']);
- expect(result.rowCount).toBe(3);
- });
-
- it('should handle countTopics', async () => {
- const mockCount = vi.fn().mockResolvedValue(10);
- vi.mocked(TopicModel).mockImplementation(function () {
- return {
- count: mockCount,
- } as any;
- });
-
- const ctx = {
- topicModel: new TopicModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicModel.count();
-
- expect(mockCount).toHaveBeenCalled();
- expect(result).toBe(10);
- });
-
- describe('agentId support', () => {
- it('should handle createTopic with agentId', async () => {
- const mockCreate = vi.fn().mockResolvedValue({ id: 'topic1' });
- vi.mocked(TopicModel).mockImplementation(function () {
- return {
- create: mockCreate,
- } as any;
- });
-
- const input = {
- agentId: 'agent1',
- sessionId: 'session1',
- title: 'Test Topic',
- };
-
- const ctx = {
- topicModel: new TopicModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicModel.create(input);
-
- expect(mockCreate).toHaveBeenCalledWith(input);
- expect(result.id).toBe('topic1');
- });
-
- it('should handle getTopics with agentId', async () => {
- const mockQuery = vi.fn().mockResolvedValue([{ id: 'topic1', title: 'Test' }]);
- vi.mocked(TopicModel).mockImplementation(function () {
- return {
- query: mockQuery,
- } as any;
- });
-
- const input = { agentId: 'agent1' };
- const ctx = {
- topicModel: new TopicModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicModel.query(input);
-
- expect(mockQuery).toHaveBeenCalledWith(input);
- expect(result).toEqual([{ id: 'topic1', title: 'Test' }]);
- });
-
- it('should handle getTopics with both agentId and sessionId', async () => {
- const mockQuery = vi.fn().mockResolvedValue([{ id: 'topic1', title: 'Test' }]);
- vi.mocked(TopicModel).mockImplementation(function () {
- return {
- query: mockQuery,
- } as any;
- });
-
- const input = { agentId: 'agent1', sessionId: 'session1' };
- const ctx = {
- topicModel: new TopicModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicModel.query(input);
-
- expect(mockQuery).toHaveBeenCalledWith(input);
- expect(result).toEqual([{ id: 'topic1', title: 'Test' }]);
- });
-
- it('should handle batchDeleteByAgentId', async () => {
- const mockBatchDeleteByAgentId = vi.fn().mockResolvedValue({ rowCount: 5 });
- vi.mocked(TopicModel).mockImplementation(function () {
- return {
- batchDeleteByAgentId: mockBatchDeleteByAgentId,
- } as any;
- });
-
- const ctx = {
- topicModel: new TopicModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicModel.batchDeleteByAgentId('agent1');
-
- expect(mockBatchDeleteByAgentId).toHaveBeenCalledWith('agent1');
- expect(result.rowCount).toBe(5);
- });
-
- it('should handle batchCreateTopics with agentId', async () => {
- const mockBatchCreate = vi.fn().mockResolvedValue([{ id: 'topic1' }, { id: 'topic2' }]);
- vi.mocked(TopicRepository).mockImplementation(function () {
- return {
- batchCreate: mockBatchCreate,
- } as any;
- });
-
- const input = [
- { agentId: 'agent1', sessionId: 'session1', title: 'Topic 1' },
- { agentId: 'agent1', sessionId: 'session1', title: 'Topic 2' },
- ];
-
- const ctx = {
- topicRepo: new TopicRepository({} as any, 'user1'),
- };
-
- const result = await ctx.topicRepo.batchCreate(input as any);
-
- expect(mockBatchCreate).toHaveBeenCalledWith(input);
- expect(result).toHaveLength(2);
- });
-
- it('should handle searchTopics with agentId', async () => {
- const mockQueryByKeyword = vi.fn().mockResolvedValue([{ id: 'topic1', title: 'Test' }]);
- vi.mocked(TopicModel).mockImplementation(function () {
- return {
- queryByKeyword: mockQueryByKeyword,
- } as any;
- });
-
- const ctx = {
- topicModel: new TopicModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicModel.queryByKeyword('test', 'session1');
-
- expect(mockQueryByKeyword).toHaveBeenCalledWith('test', 'session1');
- expect(result).toEqual([{ id: 'topic1', title: 'Test' }]);
- });
- });
-
- describe('topic sharing', () => {
- it('should handle enableSharing with default visibility', async () => {
- const mockCreate = vi.fn().mockResolvedValue({
- id: 'share-123',
- topicId: 'topic1',
- userId: 'user1',
- visibility: 'private',
- });
-
- vi.mocked(TopicShareModel).mockImplementation(function () {
- return {
- create: mockCreate,
- } as any;
- });
-
- const ctx = {
- topicShareModel: new TopicShareModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicShareModel.create('topic1');
-
- expect(mockCreate).toHaveBeenCalledWith('topic1');
- expect(result.id).toBe('share-123');
- expect(result.visibility).toBe('private');
- });
-
- it('should handle enableSharing with link visibility', async () => {
- const mockCreate = vi.fn().mockResolvedValue({
- id: 'share-456',
- topicId: 'topic1',
- userId: 'user1',
- visibility: 'link',
- });
-
- vi.mocked(TopicShareModel).mockImplementation(function () {
- return {
- create: mockCreate,
- } as any;
- });
-
- const ctx = {
- topicShareModel: new TopicShareModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicShareModel.create('topic1', 'link');
-
- expect(mockCreate).toHaveBeenCalledWith('topic1', 'link');
- expect(result.visibility).toBe('link');
- });
-
- it('should handle disableSharing', async () => {
- const mockDeleteByTopicId = vi.fn().mockResolvedValue(undefined);
-
- vi.mocked(TopicShareModel).mockImplementation(function () {
- return {
- deleteByTopicId: mockDeleteByTopicId,
- } as any;
- });
-
- const ctx = {
- topicShareModel: new TopicShareModel({} as any, 'user1'),
- };
-
- await ctx.topicShareModel.deleteByTopicId('topic1');
-
- expect(mockDeleteByTopicId).toHaveBeenCalledWith('topic1');
- });
-
- it('should handle updateShareVisibility', async () => {
- const mockUpdateVisibility = vi.fn().mockResolvedValue({
- id: 'share-123',
- topicId: 'topic1',
- visibility: 'link',
- });
-
- vi.mocked(TopicShareModel).mockImplementation(function () {
- return {
- updateVisibility: mockUpdateVisibility,
- } as any;
- });
-
- const ctx = {
- topicShareModel: new TopicShareModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicShareModel.updateVisibility('topic1', 'link');
-
- expect(mockUpdateVisibility).toHaveBeenCalledWith('topic1', 'link');
- expect(result.visibility).toBe('link');
- });
-
- it('should handle getShareInfo', async () => {
- const mockGetByTopicId = vi.fn().mockResolvedValue({
- id: 'share-123',
- topicId: 'topic1',
- visibility: 'link',
- });
-
- vi.mocked(TopicShareModel).mockImplementation(function () {
- return {
- getByTopicId: mockGetByTopicId,
- } as any;
- });
-
- const ctx = {
- topicShareModel: new TopicShareModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicShareModel.getByTopicId('topic1');
-
- expect(mockGetByTopicId).toHaveBeenCalledWith('topic1');
- expect(result).toEqual({
- id: 'share-123',
- topicId: 'topic1',
- visibility: 'link',
- });
- });
-
- it('should return null when getShareInfo for non-shared topic', async () => {
- const mockGetByTopicId = vi.fn().mockResolvedValue(null);
-
- vi.mocked(TopicShareModel).mockImplementation(function () {
- return {
- getByTopicId: mockGetByTopicId,
- } as any;
- });
-
- const ctx = {
- topicShareModel: new TopicShareModel({} as any, 'user1'),
- };
-
- const result = await ctx.topicShareModel.getByTopicId('non-shared-topic');
-
- expect(mockGetByTopicId).toHaveBeenCalledWith('non-shared-topic');
- expect(result).toBeNull();
- });
-
- it('should handle all visibility types', async () => {
- const mockCreate = vi.fn();
-
- vi.mocked(TopicShareModel).mockImplementation(function () {
- return {
- create: mockCreate,
- } as any;
- });
-
- const ctx = {
- topicShareModel: new TopicShareModel({} as any, 'user1'),
- };
-
- // Test private visibility
- mockCreate.mockResolvedValueOnce({ visibility: 'private' });
- await ctx.topicShareModel.create('topic1', 'private');
- expect(mockCreate).toHaveBeenLastCalledWith('topic1', 'private');
-
- // Test link visibility
- mockCreate.mockResolvedValueOnce({ visibility: 'link' });
- await ctx.topicShareModel.create('topic2', 'link');
- expect(mockCreate).toHaveBeenLastCalledWith('topic2', 'link');
- });
- });
-});
diff --git a/apps/server/src/services/agentEvalRun/__tests__/evaluateCase.integration.test.ts b/apps/server/src/services/agentEvalRun/__tests__/evaluateCase.integration.test.ts
index f607af14989..84cbf6ec9a6 100644
--- a/apps/server/src/services/agentEvalRun/__tests__/evaluateCase.integration.test.ts
+++ b/apps/server/src/services/agentEvalRun/__tests__/evaluateCase.integration.test.ts
@@ -205,33 +205,4 @@ describe('evaluateCase - evalMode resolution', () => {
expect(runTopic?.status).toBeNull();
expect(runTopic?.score).toBeNull();
});
-
- it('should not crash when benchmark rubrics is empty and evalMode is null everywhere', async () => {
- // rubrics column is NOT NULL in DB, so worst case is empty array []
- // Combined with evalMode=null everywhere, this exercises the "no eval rules" path
- const { run, testCase } = await setupEvalChain({
- benchmarkRubrics: [],
- datasetEvalMode: null,
- expected: '42',
- output: '42',
- testCaseEvalMode: null,
- });
-
- const service = new AgentEvalRunService(serverDB, userId);
-
- // This should NOT throw — should gracefully skip evaluation
- await expect(
- service.recordTrajectoryCompletion({
- runId: run.id,
- testCaseId: testCase.id,
- telemetry: { completionReason: 'stop', duration: 100 },
- }),
- ).resolves.not.toThrow();
-
- // Verify: no evaluation happened (score/status remain null)
- const runTopicModel = new AgentEvalRunTopicModel(serverDB, userId);
- const runTopic = await runTopicModel.findByRunAndTestCase(run.id, testCase.id);
- expect(runTopic?.score).toBeNull();
- expect(runTopic?.status).toBeNull();
- });
});
diff --git a/apps/server/src/services/agentSignal/observability/__tests__/projector.test.ts b/apps/server/src/services/agentSignal/observability/__tests__/projector.test.ts
deleted file mode 100644
index 4aa182dca59..00000000000
--- a/apps/server/src/services/agentSignal/observability/__tests__/projector.test.ts
+++ /dev/null
@@ -1,70 +0,0 @@
-import { describe, expect, it } from 'vitest';
-
-import type { AgentSignalTelemetryRecord, AgentSignalTraceEnvelope } from '../types';
-
-describe('AgentSignal observability contracts', () => {
- /**
- * @example
- * const record = { summary: { totalSignals: 1 } } satisfies AgentSignalTelemetryRecord;
- * expect(record.summary.totalSignals).toBe(1);
- */
- it('supports compact summary records with conclusion chains', () => {
- const record: AgentSignalTelemetryRecord = {
- chainId: 'chain_1',
- conclusionChain: {
- compressedSignals: {},
- dominantPath: ['agent.user.message', 'signal.sample.accepted'],
- },
- createdAt: '2026-04-21T00:00:00.000Z',
- id: 'telemetry_1',
- rootSourceId: 'source_1',
- scopeKey: 'topic:t1',
- sourceId: 'source_1',
- sourceType: 'agent.user.message',
- summary: {
- attemptBreakdown: {
- failed: 0,
- retriableFailures: 0,
- skipped: 0,
- succeeded: 1,
- total: 1,
- },
- domains: ['sample'],
- outcomes: ['accepted'],
- statusBreakdown: { applied: 1, failed: 0, skipped: 0 },
- totalActions: 1,
- totalSignals: 1,
- },
- };
-
- expect(record.summary.totalSignals).toBe(1);
- });
-
- /**
- * @example
- * const envelope = { edges: [{ relation: 'produced' }] } satisfies AgentSignalTraceEnvelope;
- * expect(envelope.edges[0].relation).toBe('produced');
- */
- it('supports expanded trace envelopes with nodes and edges', () => {
- const envelope: AgentSignalTraceEnvelope = {
- actions: [],
- chainId: 'chain_1',
- edges: [{ from: 'source_1', relation: 'produced', to: 'signal_1' }],
- handlerRuns: [],
- rootSourceId: 'source_1',
- results: [],
- signals: [],
- source: {
- chain: { chainId: 'chain_1', rootSourceId: 'source_1' },
- payload: { message: 'remember this', messageId: 'msg_1' },
- scopeKey: 'topic:t1',
- sourceId: 'source_1',
- sourceType: 'agent.user.message',
- timestamp: 1,
- },
- version: 1,
- };
-
- expect(envelope.edges[0].relation).toBe('produced');
- });
-});
diff --git a/apps/server/src/services/agentSignal/processors/__tests__/procedure.test.ts b/apps/server/src/services/agentSignal/processors/__tests__/procedure.test.ts
index c8f07b73ba8..1c51d97b570 100644
--- a/apps/server/src/services/agentSignal/processors/__tests__/procedure.test.ts
+++ b/apps/server/src/services/agentSignal/processors/__tests__/procedure.test.ts
@@ -7,7 +7,6 @@ import { createRuntimeProcessorContext } from '../../runtime/context';
import type { ProcedureStateService } from '../../services/types';
import {
accumulateSignal,
- type FeedbackDomainSignal,
type SatisfiedSkillFeedbackDomainSignal,
scoreIncrease,
suppressHandled,
@@ -192,18 +191,6 @@ const createScored = (
};
describe('procedure processors', () => {
- /**
- * @example
- * Exact policy signal fixtures compile against the processor input contracts.
- */
- it('uses exact policy signal fixtures for processor inputs', () => {
- const feedbackSignal: FeedbackDomainSignal = createMemorySignal();
- const skillSignal: SatisfiedSkillFeedbackDomainSignal = createSatisfiedSkillSignal();
-
- expect(feedbackSignal.signalType).toBe('signal.feedback.domain.memory');
- expect(skillSignal.payload.satisfactionResult).toBe('satisfied');
- });
-
/**
* @example
* A satisfied memory signal checks `memory:user-preference` handled markers, then stops with a no-op.
diff --git a/apps/server/src/services/comfyui/__tests__/core/comfyUIAuthService.test.ts b/apps/server/src/services/comfyui/__tests__/core/comfyUIAuthService.test.ts
index 98b0171ab98..fcdd0306780 100644
--- a/apps/server/src/services/comfyui/__tests__/core/comfyUIAuthService.test.ts
+++ b/apps/server/src/services/comfyui/__tests__/core/comfyUIAuthService.test.ts
@@ -121,18 +121,6 @@ describe('ComfyUIAuthService', () => {
});
describe('Edge cases', () => {
- it('should handle partial basic auth gracefully in headers', () => {
- // This tests the createAuthHeaders method behavior
- const options: ComfyUIKeyVault = {
- authType: 'basic',
- username: 'testuser',
- password: 'testpass',
- };
-
- const service = new ComfyUIAuthService(options);
- expect(service.getAuthHeaders()).toBeDefined();
- });
-
it('should handle partial bearer auth gracefully in headers', () => {
const options: ComfyUIKeyVault = {
authType: 'bearer',
diff --git a/apps/server/src/services/comfyui/__tests__/utils/componentInfo.test.ts b/apps/server/src/services/comfyui/__tests__/utils/componentInfo.test.ts
index cc7fbeb6bd7..46cab4e468b 100644
--- a/apps/server/src/services/comfyui/__tests__/utils/componentInfo.test.ts
+++ b/apps/server/src/services/comfyui/__tests__/utils/componentInfo.test.ts
@@ -177,18 +177,6 @@ describe('componentInfo.ts', () => {
const resultUndefined = getComponentInfo(undefined as any);
expect(resultUndefined).toBeUndefined();
});
-
- it('should work with different file extensions', () => {
- // Since we're mocking the entire module, we need to test the existing mock data
- // This test validates that the function works with the current mock setup
- const result = getComponentInfo('clip-l.safetensors');
- expect(result).toEqual({
- displayName: 'CLIP text encoder',
- folderPath: 'models/clip',
- nodeType: 'CLIPTextEncode',
- type: 'clip',
- });
- });
});
describe('isSystemComponent', () => {
diff --git a/apps/server/src/services/goal/manager/index.surface.test.ts b/apps/server/src/services/goal/manager/index.surface.test.ts
index 08466c5490f..c4e12c446ec 100644
--- a/apps/server/src/services/goal/manager/index.surface.test.ts
+++ b/apps/server/src/services/goal/manager/index.surface.test.ts
@@ -11,7 +11,6 @@ import {
GoalManagerService,
goalPlanSchema,
managerSnapshot,
- MAX_FAILED_MANAGER_TURNS,
problemKey,
} from './index';
@@ -31,7 +30,6 @@ describe('goal manager public surface', () => {
'managerSnapshot',
'problemKey',
]);
- expect(MAX_FAILED_MANAGER_TURNS).toBe(5);
});
it('exposes the same public members on the service', () => {
@@ -54,8 +52,6 @@ describe('goal manager public surface', () => {
];
for (const member of members)
expect(typeof (service as unknown as Record<string, unknown>)[member]).toBe('function');
- // `planInstead` stays a prototype method: tests spy on it there.
- expect(Object.hasOwn(GoalManagerService.prototype, 'planInstead')).toBe(true);
});
it('keys a takeover problem by its task, and reads the answered one back', () => {
diff --git a/apps/server/src/services/mcp/contentProcessor.test.ts b/apps/server/src/services/mcp/contentProcessor.test.ts
index 47a39229940..0af2fef6e04 100644
--- a/apps/server/src/services/mcp/contentProcessor.test.ts
+++ b/apps/server/src/services/mcp/contentProcessor.test.ts
@@ -39,8 +39,6 @@ describe('contentProcessor', () => {
];
const result = contentBlocksToString(blocks);
expect(result).toBe('![](https://example.com/f/abc-123)');
- // Ensure no double URL prefix
- expect(result).not.toContain('https://example.com/https://example.com');
});
it('should convert audio content with full URL without double prefix', () => {
@@ -53,7 +51,6 @@ describe('contentProcessor', () => {
];
const result = contentBlocksToString(blocks);
expect(result).toBe('<resource type="audio" url="https://example.com/f/audio-123" />');
- expect(result).not.toContain('https://example.com/https://example.com');
});
it('should join multiple content blocks with double newlines', () => {
@@ -308,8 +305,6 @@ describe('contentProcessor', () => {
const str = contentBlocksToString(processed);
expect(str).toBe('Here is the screenshot:\n\n![](https://myapp.com/f/img-uuid)');
- // The critical assertion: no double URL prefix
- expect(str).not.toContain('https://myapp.com/https://myapp.com');
});
});
});
diff --git a/apps/server/src/services/mcp/index.manifestDescriptions.test.ts b/apps/server/src/services/mcp/index.manifestDescriptions.test.ts
index 4196c666992..2697ae1f04d 100644
--- a/apps/server/src/services/mcp/index.manifestDescriptions.test.ts
+++ b/apps/server/src/services/mcp/index.manifestDescriptions.test.ts
@@ -65,7 +65,6 @@ describe('MCP automatic descriptions and installed tool prompts', () => {
const result = await service.getStdioMcpServerManifest({ command: 'mcp', name: 'test-mcp' });
expect(result.meta.description).toBe(expected);
- expect(result.meta.description).not.toContain('undefined');
},
);
@@ -82,7 +81,6 @@ describe('MCP automatic descriptions and installed tool prompts', () => {
);
expect(result.meta.description).toBe(scenario.expected);
- expect(result.meta.description).not.toContain('undefined');
},
);
diff --git a/apps/server/src/services/memory/userMemory/__tests__/extract.surface.test.ts b/apps/server/src/services/memory/userMemory/__tests__/extract.surface.test.ts
index cb53b7ff99f..9521172fb76 100644
--- a/apps/server/src/services/memory/userMemory/__tests__/extract.surface.test.ts
+++ b/apps/server/src/services/memory/userMemory/__tests__/extract.surface.test.ts
@@ -81,40 +81,6 @@ describe('extract module surface', () => {
});
it('keeps the executor prototype and static members', () => {
- expect(functionMembers(MemoryExtractionExecutor.prototype)).toEqual([
- 'buildBaseMetadata',
- 'countTokens',
- 'extractBenchmarkSource',
- 'extractTopic',
- 'filterTopicIdsForUser',
- 'generateEmbeddings',
- 'getAiProviderRuntimeState',
- 'getOnExtractHooksPath',
- 'getRuntime',
- 'getTopicsForUser',
- 'getUsers',
- 'getUsersForHourlyExtraction',
- 'listConversationsForTopic',
- 'listRelevantUserMemories',
- 'listUserMemoryIdentities',
- 'normalizeLayerError',
- 'persistActivityMemories',
- 'persistContextMemories',
- 'persistExperienceMemories',
- 'persistExtraction',
- 'persistIdentityMemories',
- 'persistPreferenceMemories',
- 'recordJobMetrics',
- 'recordLayerEntries',
- 'reportUserInitiatedProgress',
- 'resolveRuntimeKeyVaults',
- 'resolveUserMemoryAgent',
- 'resolveUserMemoryServiceConfig',
- 'runDirect',
- 'trimConversationsToTokenLimit',
- 'trimTextToTokenLimit',
- 'uploadExtractionTrace',
- ]);
expect(functionMembers(MemoryExtractionExecutor)).toEqual(['create']);
expect(functionMembers(MemoryExtractionWorkflowService)).toEqual([
'getClient',
diff --git a/apps/server/src/services/onboarding/index.test.ts b/apps/server/src/services/onboarding/index.test.ts
index 35f377c0f0a..4f7df6bd02e 100644
--- a/apps/server/src/services/onboarding/index.test.ts
+++ b/apps/server/src/services/onboarding/index.test.ts
@@ -1043,9 +1043,6 @@ describe('OnboardingService', () => {
});
expect(executeSpy).toHaveBeenCalledTimes(1);
- // The first (only) execute call inside the transaction is the advisory lock.
- // We assert structurally rather than on the exact SQL fragment.
- expect(executeSpy).toHaveBeenCalled();
});
});
});
diff --git a/apps/server/src/services/toolExecution/serverRuntimes/__tests__/task.test.ts b/apps/server/src/services/toolExecution/serverRuntimes/__tests__/task.test.ts
index fd86ad32033..d7cd8be79b8 100644
--- a/apps/server/src/services/toolExecution/serverRuntimes/__tests__/task.test.ts
+++ b/apps/server/src/services/toolExecution/serverRuntimes/__tests__/task.test.ts
@@ -873,8 +873,6 @@ describe('createTaskRuntime', () => {
// clickable when the message is delivered to IM / mobile.
expect(result.content).toContain('[T-A](https://app.lobehub.com/task/T-A)');
expect(result.content).toContain('[T-B](https://app.lobehub.com/task/T-B)');
- expect(result.content).toContain('T-A');
- expect(result.content).toContain('T-B');
// State parity with the client executor: the dispatch-layer registration
// reads per-item identity + success from `state.results`.
expect(result.state).toEqual({
diff --git a/packages/app-config/src/featureFlags/utils/parser.test.ts b/packages/app-config/src/featureFlags/utils/parser.test.ts
index c522ab8483e..43062c97ba9 100644
--- a/packages/app-config/src/featureFlags/utils/parser.test.ts
+++ b/packages/app-config/src/featureFlags/utils/parser.test.ts
@@ -47,16 +47,6 @@ describe('parseFeatureFlag', () => {
expect(parseFeatureFlag(input)).toEqual({});
});
- it('invalid flag format return nothing', () => {
- const input = 'invalid_format';
- expect(parseFeatureFlag(input)).toEqual({});
- });
-
- it('invalid format return empty object', () => {
- const input = '+webrtc_sync:unexpected';
- expect(parseFeatureFlag(input)).toEqual({});
- });
-
it('ignores unknown flag names while keeping known ones', () => {
expect(parseFeatureFlag('-some_removed_flag')).toEqual({});
expect(parseFeatureFlag('+some_removed_flag,+api_key_manage')).toEqual({
diff --git a/packages/builtin-agents/src/agents/builtinAvatars.test.ts b/packages/builtin-agents/src/agents/builtinAvatars.test.ts
index f454d16bf5f..a933b5b52c1 100644
--- a/packages/builtin-agents/src/agents/builtinAvatars.test.ts
+++ b/packages/builtin-agents/src/agents/builtinAvatars.test.ts
@@ -59,13 +59,6 @@ describe('built-in agent avatars', () => {
expect(avatar, agent).toBe('/branding/logo.png');
});
- it('leaves no upstream mascot behind under custom branding', async () => {
- const avatars = await loadAvatars('/branding/logo.png');
-
- for (const [agent, avatar] of Object.entries(avatars))
- expect(avatar, agent).not.toMatch(/\/avatars\//);
- });
-
// Upstream ships no logo, and each agent's own artwork is worth keeping there.
it('keeps each agent distinct when no logo is configured', async () => {
const avatars = await loadAvatars('');
diff --git a/packages/builtin-tool-activator/src/ExecutionRuntime/__tests__/activateTools-resolution.test.ts b/packages/builtin-tool-activator/src/ExecutionRuntime/__tests__/activateTools-resolution.test.ts
index ab1564a4dc5..cd77adaa855 100644
--- a/packages/builtin-tool-activator/src/ExecutionRuntime/__tests__/activateTools-resolution.test.ts
+++ b/packages/builtin-tool-activator/src/ExecutionRuntime/__tests__/activateTools-resolution.test.ts
@@ -165,23 +165,6 @@ describe('ActivatorExecutionRuntime.activateTools — request-name resolution',
expect(result.state?.notFound).toEqual([]);
});
- it('activates a tool requested by a wire name with an MD5-compressed api segment, mirroring ToolNameResolver variants', async () => {
- // Codex P2 on PR #20791: `ToolNameResolver.generate` compresses the api
- // segment to `MD5HASH_…` when the name is provider-invalid or over the
- // length cap; a request copied from `tools[]` must match that exact
- // variant instead of falling to the prefix probe.
- const service = buildService([webBrowsingManifest]);
- const runtime = new ActivatorExecutionRuntime({ service });
-
- const result = await runtime.activateTools({
- identifiers: ['lobe-web-browsing____' + wireHash('search')],
- reason: 'test',
- });
-
- expect(result.content).toContain('Successfully activated tools: lobe-web-browsing.search');
- expect(result.state?.notFound).toEqual([]);
- });
-
it('activates a tool requested by a wire name whose identifier segment is MD5-compressed', async () => {
// Codex P2 on PR #20791: when the identifier makes the generated name
// exceed the provider length cap, `ToolNameResolver.generate` hashes the
diff --git a/packages/builtin-tool-claude-code/src/client/Render/displayControls.test.ts b/packages/builtin-tool-claude-code/src/client/Render/displayControls.test.ts
index fd15e42929b..73cd6ee68d8 100644
--- a/packages/builtin-tool-claude-code/src/client/Render/displayControls.test.ts
+++ b/packages/builtin-tool-claude-code/src/client/Render/displayControls.test.ts
@@ -30,12 +30,6 @@ describe('resolveClaudeCodeRenderDisplayControl', () => {
}),
).toBeUndefined();
});
-
- it('is still collapsed while the call is in flight (no result yet)', () => {
- expect(
- resolveClaudeCodeRenderDisplayControl(ClaudeCodeApiName.Read, undefined),
- ).toBeUndefined();
- });
});
describe('in-app browser screenshot', () => {
diff --git a/packages/builtin-tool-cloud-sandbox/src/workspace.test.ts b/packages/builtin-tool-cloud-sandbox/src/workspace.test.ts
index 4ffe4be5187..ece2a527188 100644
--- a/packages/builtin-tool-cloud-sandbox/src/workspace.test.ts
+++ b/packages/builtin-tool-cloud-sandbox/src/workspace.test.ts
@@ -104,15 +104,3 @@ describe('the three placements a run can have', () => {
).not.toContain(persisted);
});
});
-
-describe('the placement text the skills runtime also renders', () => {
- it('keeps the ephemeral default renderable without any persistence input', () => {
- // The skills tool now carries `{{sandbox_workspace}}` too, and its prompt
- // is assembled for every run — including the ones with no entitlement, where
- // the variable generators call this with nothing.
- const { sandbox_workspace: prompt } = formatSandboxStoragePromptVariables();
-
- expect(prompt).toContain('Files created here are temporary and session-specific');
- expect(prompt).not.toContain('{{');
- });
-});
diff --git a/packages/builtin-tool-creds/src/helpers.test.ts b/packages/builtin-tool-creds/src/helpers.test.ts
index 030e15cdf99..9f588295424 100644
--- a/packages/builtin-tool-creds/src/helpers.test.ts
+++ b/packages/builtin-tool-creds/src/helpers.test.ts
@@ -86,7 +86,6 @@ describe('resolveAvailableComposioServices', () => {
it('excludes a disabled app type even though it is not connected', () => {
const result = resolveAvailableComposioServices(appTypes, new Set(), new Set(['slack']));
- expect(result.map((s) => s.identifier)).not.toContain('slack');
expect(result.map((s) => s.identifier)).toEqual(['gmail', 'jira']);
});
diff --git a/packages/builtin-tool-group-management/src/executor.test.ts b/packages/builtin-tool-group-management/src/executor.test.ts
index f4f214d0ee9..a80bca0d785 100644
--- a/packages/builtin-tool-group-management/src/executor.test.ts
+++ b/packages/builtin-tool-group-management/src/executor.test.ts
@@ -340,18 +340,6 @@ describe('GroupManagementExecutor', () => {
});
});
- it('should not fail when groupOrchestration is not available', async () => {
- const ctx = createMockContext();
-
- const result = await groupManagementExecutor.executeAgentTask(
- { agentId: 'agent-1', instruction: 'Do something', title: 'Test Task' },
- ctx,
- );
-
- expect(result.success).toBe(true);
- expect(result.stop).toBe(true);
- });
-
it('should include timeout in state when provided', async () => {
const ctx = createMockContext();
diff --git a/packages/builtin-tool-local-system/src/__tests__/grepContentForwarding.test.ts b/packages/builtin-tool-local-system/src/__tests__/grepContentForwarding.test.ts
index c05d93fcb92..10d3abcbeba 100644
--- a/packages/builtin-tool-local-system/src/__tests__/grepContentForwarding.test.ts
+++ b/packages/builtin-tool-local-system/src/__tests__/grepContentForwarding.test.ts
@@ -68,12 +68,6 @@ describe('localSystemExecutor.grepContent — params forwarding', () => {
'path': '/Users/arvinxx/CodeProjects/LobeHub/lobehub-desktop',
});
- // And it must NOT have been collapsed to the stripped {directory, pattern} shape.
- expect(forwarded).not.toEqual({
- directory: expect.any(String),
- pattern: expect.any(String),
- });
-
spy.mockRestore();
});
diff --git a/packages/builtin-tool-local-system/src/client/displayControls.test.ts b/packages/builtin-tool-local-system/src/client/displayControls.test.ts
index cc479853fcc..553e3dad056 100644
--- a/packages/builtin-tool-local-system/src/client/displayControls.test.ts
+++ b/packages/builtin-tool-local-system/src/client/displayControls.test.ts
@@ -20,7 +20,6 @@ describe('resolveLocalSystemRenderDisplayControl', () => {
it('keeps the card collapsed while the read is still in flight', () => {
expect(resolveLocalSystemRenderDisplayControl('readFile')).toBeUndefined();
- expect(resolveLocalSystemRenderDisplayControl('readFile', undefined)).toBeUndefined();
});
it('does not open an empty card when the image never got a url', () => {
diff --git a/packages/builtin-tool-local-system/src/client/executor/index.test.ts b/packages/builtin-tool-local-system/src/client/executor/index.test.ts
index 3fcb1f736de..e4148d31fb6 100644
--- a/packages/builtin-tool-local-system/src/client/executor/index.test.ts
+++ b/packages/builtin-tool-local-system/src/client/executor/index.test.ts
@@ -81,7 +81,6 @@ describe('LocalSystemExecutor', () => {
});
expect(result.content).toBeTruthy();
- expect(result.content).not.toBe('');
expect(result.state).toEqual({
files: [],
pattern: '**/*never-matches*',
@@ -113,7 +112,6 @@ describe('LocalSystemExecutor', () => {
// `usage.tools.byTool[].errors`, so a permission-denied glob must not
// count as a successful call.
expect(result.success).toBe(false);
- expect(result.content).toBeTruthy();
expect(result.content).toContain('EACCES');
expect(result.state).toEqual({
files: [],
diff --git a/packages/builtin-tool-skill-maintainer/src/manifest.test.ts b/packages/builtin-tool-skill-maintainer/src/manifest.test.ts
index d1abf84169e..2698e3c3d84 100644
--- a/packages/builtin-tool-skill-maintainer/src/manifest.test.ts
+++ b/packages/builtin-tool-skill-maintainer/src/manifest.test.ts
@@ -16,21 +16,4 @@ describe('SkillMaintainerManifest', () => {
'replaceSkillIndex',
]);
});
-
- /**
- * @example
- * Path, resource, delete, and broad exploration APIs stay out of the active manifest.
- */
- it('does not expose forbidden v1 APIs', () => {
- const names = SkillMaintainerManifest.api.map((item) => item.name);
-
- expect(names).not.toContain('consolidate');
- expect(names).not.toContain('deleteSkill');
- expect(names).not.toContain('forkSkill');
- expect(names).not.toContain('listSkillResources');
- expect(names).not.toContain('mergeSkill');
- expect(names).not.toContain('readSkillFile');
- expect(names).not.toContain('removeSkillFile');
- expect(names).not.toContain('writeSkillFile');
- });
});
diff --git a/packages/database/src/models/__tests__/agentCronJob.test.ts b/packages/database/src/models/__tests__/agentCronJob.test.ts
index 9fb74287313..e53e72555ab 100644
--- a/packages/database/src/models/__tests__/agentCronJob.test.ts
+++ b/packages/database/src/models/__tests__/agentCronJob.test.ts
@@ -34,13 +34,6 @@ afterEach(async () => {
});
describe('AgentCronJobModel', () => {
- describe('constructor', () => {
- it('should create model with db and userId', () => {
- const model = new AgentCronJobModel(serverDB, userId);
- expect(model).toBeInstanceOf(AgentCronJobModel);
- });
- });
-
describe('create', () => {
it('should create a cron job with required fields', async () => {
const model = new AgentCronJobModel(serverDB, userId);
diff --git a/packages/database/src/models/__tests__/generation.test.ts b/packages/database/src/models/__tests__/generation.test.ts
index 5e02d7823c0..ae84e6038a3 100644
--- a/packages/database/src/models/__tests__/generation.test.ts
+++ b/packages/database/src/models/__tests__/generation.test.ts
@@ -173,12 +173,6 @@ describe('GenerationModel', () => {
});
});
- it('should automatically set userId when creating generation', async () => {
- const result = await generationModel.create(testGeneration);
-
- expect(result.userId).toBe(userId);
- });
-
it('should create generation with minimal data', async () => {
const minimalGeneration: Omit<NewGeneration, 'userId'> = {
generationBatchId: 'test-batch-id',
diff --git a/packages/database/src/models/__tests__/messages/message.publicApi.test.ts b/packages/database/src/models/__tests__/messages/message.publicApi.test.ts
index 41781202a93..4b6e55f7d9d 100644
--- a/packages/database/src/models/__tests__/messages/message.publicApi.test.ts
+++ b/packages/database/src/models/__tests__/messages/message.publicApi.test.ts
@@ -99,17 +99,15 @@ const PUBLIC_INSTANCE_METHODS = [
] as const;
describe('MessageModel public API', () => {
- it('exposes every public method as an own function property', () => {
+ it('exposes every public method as a function', () => {
const model = new MessageModel(serverDB, userId);
for (const name of PUBLIC_INSTANCE_METHODS) {
- expect(Object.prototype.hasOwnProperty.call(model, name), name).toBe(true);
expect(typeof model[name], name).toBe('function');
}
});
- it('keeps updateMessageRAG on the prototype and checkUsersHaveMessages static', () => {
- expect(typeof MessageModel.prototype.updateMessageRAG).toBe('function');
+ it('keeps checkUsersHaveMessages static', () => {
expect(typeof MessageModel.checkUsersHaveMessages).toBe('function');
});
diff --git a/packages/database/src/models/agentEval/__tests__/benchmark.test.ts b/packages/database/src/models/agentEval/__tests__/benchmark.test.ts
index f696b56e0ac..20db68ec829 100644
--- a/packages/database/src/models/agentEval/__tests__/benchmark.test.ts
+++ b/packages/database/src/models/agentEval/__tests__/benchmark.test.ts
@@ -215,21 +215,6 @@ describe('AgentEvalBenchmarkModel', () => {
expect(results).toHaveLength(3);
});
- it("should not return other user's benchmarks", async () => {
- const results = await benchmarkModel.query(true);
-
- const identifiers = results.map((r) => r.identifier);
- expect(identifiers).not.toContain('other-user-1');
- });
-
- it('should order by createdAt descending', async () => {
- const results = await benchmarkModel.query(true);
-
- // The newest should come first
- // Order may vary in PGlite due to timing
- expect(results.length).toBeGreaterThanOrEqual(3);
- });
-
it('should return datasetCount for benchmarks with datasets', async () => {
// Find the user-1 benchmark
const benchmarks = await serverDB.query.agentEvalBenchmarks.findMany();
diff --git a/packages/database/src/models/agentEval/__tests__/dataset.test.ts b/packages/database/src/models/agentEval/__tests__/dataset.test.ts
index 99e5d9abf9f..b34b18d5d16 100644
--- a/packages/database/src/models/agentEval/__tests__/dataset.test.ts
+++ b/packages/database/src/models/agentEval/__tests__/dataset.test.ts
@@ -270,14 +270,6 @@ describe('AgentEvalDatasetModel', () => {
expect(results.map((r) => r.identifier)).toEqual(['scoped-dataset']);
});
- it('should order by createdAt descending', async () => {
- const results = await datasetModel.query();
-
- // The newest should come first
- // Order may vary, just check we got results
- expect(results.length).toBeGreaterThanOrEqual(2);
- });
-
it('should include system datasets (userId is null)', async () => {
const results = await datasetModel.query();
diff --git a/packages/database/src/models/agentEval/__tests__/run.test.ts b/packages/database/src/models/agentEval/__tests__/run.test.ts
index 476a5f21ef7..e4c6d188b1a 100644
--- a/packages/database/src/models/agentEval/__tests__/run.test.ts
+++ b/packages/database/src/models/agentEval/__tests__/run.test.ts
@@ -138,12 +138,6 @@ describe('AgentEvalRunModel', () => {
passRate: 0,
});
});
-
- it('should default status to idle', async () => {
- const result = await runModel.create({ datasetId });
-
- expect(result.status).toBe('idle');
- });
});
describe('query', () => {
@@ -273,13 +267,6 @@ describe('AgentEvalRunModel', () => {
expect(offsetResults).toHaveLength(2);
expect(offsetResults[0].id).toBe(allResults[1].id);
});
-
- it('should order by createdAt descending', async () => {
- const results = await runModel.query();
-
- // Most recent should be first
- expect(results.length).toBeGreaterThanOrEqual(3);
- });
});
describe('findById', () => {
diff --git a/packages/database/src/models/userMemory/__tests__/activity.test.ts b/packages/database/src/models/userMemory/__tests__/activity.test.ts
index c47e5304b2e..8d3ee0a7874 100644
--- a/packages/database/src/models/userMemory/__tests__/activity.test.ts
+++ b/packages/database/src/models/userMemory/__tests__/activity.test.ts
@@ -102,13 +102,6 @@ describe('UserMemoryActivityModel', () => {
expect(result).toHaveLength(1);
expect(result[0].id).toBe('activity-2');
});
-
- it('should not return other users activities', async () => {
- const result = await activityModel.query();
-
- const otherActivity = result.find((a) => a.id === 'other-activity');
- expect(otherActivity).toBeUndefined();
- });
});
describe('queryList', () => {
diff --git a/packages/database/src/models/userMemory/__tests__/context.test.ts b/packages/database/src/models/userMemory/__tests__/context.test.ts
index 492b5941a05..d6b813f8b47 100644
--- a/packages/database/src/models/userMemory/__tests__/context.test.ts
+++ b/packages/database/src/models/userMemory/__tests__/context.test.ts
@@ -99,13 +99,6 @@ describe('UserMemoryContextModel', () => {
expect(result[0].id).toBe('context-2');
});
- it('should not return other users contexts', async () => {
- const result = await contextModel.query();
-
- const otherContext = result.find((c) => c.id === 'other-context');
- expect(otherContext).toBeUndefined();
- });
-
it('hides contexts with only trashed parents but keeps one with a live parent', async () => {
await serverDB.insert(userMemories).values([
{
diff --git a/packages/database/src/models/userMemory/__tests__/experience.test.ts b/packages/database/src/models/userMemory/__tests__/experience.test.ts
index acf33de574b..7f2b6e21dae 100644
--- a/packages/database/src/models/userMemory/__tests__/experience.test.ts
+++ b/packages/database/src/models/userMemory/__tests__/experience.test.ts
@@ -102,13 +102,6 @@ describe('UserMemoryExperienceModel', () => {
expect(result).toHaveLength(1);
expect(result[0].id).toBe('experience-2');
});
-
- it('should not return other users experiences', async () => {
- const result = await experienceModel.query();
-
- const otherExperience = result.find((e) => e.id === 'other-experience');
- expect(otherExperience).toBeUndefined();
- });
});
describe('findById', () => {
diff --git a/packages/database/src/models/userMemory/__tests__/identity.test.ts b/packages/database/src/models/userMemory/__tests__/identity.test.ts
index 6564ee96114..c5040d21386 100644
--- a/packages/database/src/models/userMemory/__tests__/identity.test.ts
+++ b/packages/database/src/models/userMemory/__tests__/identity.test.ts
@@ -104,13 +104,6 @@ describe('UserMemoryIdentityModel', () => {
expect(result).toHaveLength(1);
expect(result[0].id).toBe('identity-2');
});
-
- it('should not return other users identities', async () => {
- const result = await identityModel.query();
-
- const otherIdentity = result.find((i) => i.id === 'other-identity');
- expect(otherIdentity).toBeUndefined();
- });
});
describe('findById', () => {
@@ -659,13 +652,6 @@ describe('UserMemoryIdentityModel', () => {
expect(result[0].id).toBe('self-identity');
});
- it('should not return other users identities', async () => {
- const result = await identityModel.queryForInjection();
-
- const otherUserIdentity = result.find((i) => i.id === 'other-user-self');
- expect(otherUserIdentity).toBeUndefined();
- });
-
it('should return correct fields for injection', async () => {
const result = await identityModel.queryForInjection();
diff --git a/packages/database/src/models/userMemory/__tests__/model.surface.test.ts b/packages/database/src/models/userMemory/__tests__/model.surface.test.ts
index dd98ac734b8..9cee0ac1846 100644
--- a/packages/database/src/models/userMemory/__tests__/model.surface.test.ts
+++ b/packages/database/src/models/userMemory/__tests__/model.surface.test.ts
@@ -57,12 +57,7 @@ describe('UserMemoryModel surface', () => {
]);
});
- it('keeps the prototype helpers and static parsers', () => {
- expect(functionMembers(UserMemoryModel.prototype)).toEqual([
- 'buildBaseMemoryInsertValues',
- 'extractSourceMetadata',
- 'memoryWhere',
- ]);
+ it('keeps the static parsers', () => {
expect(functionMembers(UserMemoryModel)).toEqual([
'parseAssociatedLocations',
'parseAssociatedObjects',
diff --git a/packages/database/src/models/userMemory/__tests__/preference.test.ts b/packages/database/src/models/userMemory/__tests__/preference.test.ts
index 39e123ebd54..103e69f94dd 100644
--- a/packages/database/src/models/userMemory/__tests__/preference.test.ts
+++ b/packages/database/src/models/userMemory/__tests__/preference.test.ts
@@ -100,13 +100,6 @@ describe('UserMemoryPreferenceModel', () => {
expect(result).toHaveLength(1);
expect(result[0].id).toBe('preference-2');
});
-
- it('should not return other users preferences', async () => {
- const result = await preferenceModel.query();
-
- const otherPreference = result.find((p) => p.id === 'other-preference');
- expect(otherPreference).toBeUndefined();
- });
});
describe('findById', () => {
diff --git a/packages/database/src/models/userMemory/__tests__/query.surface.test.ts b/packages/database/src/models/userMemory/__tests__/query.surface.test.ts
index cd82d9b25f5..d4c52f16d14 100644
--- a/packages/database/src/models/userMemory/__tests__/query.surface.test.ts
+++ b/packages/database/src/models/userMemory/__tests__/query.surface.test.ts
@@ -30,34 +30,6 @@ describe('UserMemoryQueryModel surface', () => {
expect(functionMembers(createModel())).toEqual(['queryTaxonomyOptions', 'searchMemory']);
});
- it('keeps the per-layer retrieval methods on the instance prototype', () => {
- expect(functionMembers(UserMemoryQueryModel.prototype)).toEqual(
- expect.arrayContaining([
- 'aggregateBaseArrayOptions',
- 'aggregateBaseMemoryOptions',
- 'aggregateIdentityValueOptions',
- 'aggregateLayerLabels',
- 'aggregateLayerTypes',
- 'aggregateStatuses',
- 'searchActivitiesLexical',
- 'searchActivitiesSemantic',
- 'searchContextsLexical',
- 'searchContextsSemantic',
- 'searchExperiencesLexical',
- 'searchExperiencesSemantic',
- 'searchHybridActivities',
- 'searchHybridContexts',
- 'searchHybridExperiences',
- 'searchHybridIdentities',
- 'searchHybridPreferences',
- 'searchIdentitiesLexical',
- 'searchIdentitiesSemantic',
- 'searchPreferencesLexical',
- 'searchPreferencesSemantic',
- ]),
- );
- });
-
it('dispatches queryTaxonomyOptions through the instance aggregations', async () => {
const model = createModel();
const option = (value: string) => [{ count: 1, layers: undefined, value }];
diff --git a/packages/database/src/repositories/home/__tests__/index.test.ts b/packages/database/src/repositories/home/__tests__/index.test.ts
index 929a9332173..35f0d9c1430 100644
--- a/packages/database/src/repositories/home/__tests__/index.test.ts
+++ b/packages/database/src/repositories/home/__tests__/index.test.ts
@@ -608,16 +608,6 @@ describe('HomeRepository', () => {
expect(result[0].title).toBe('Standalone Searchable Agent');
});
- it('should search and return mixed agents with and without session relationships', async () => {
- // Search for "Searchable" should return all 3 agents
- const result = await homeRepo.searchAgents('Searchable');
-
- expect(result).toHaveLength(3);
- expect(result.map((a) => a.id)).toContain('search-pinned');
- expect(result.map((a) => a.id)).toContain('search-unpinned');
- expect(result.map((a) => a.id)).toContain('search-standalone');
- });
-
it('should search agents by title and return correct pinned status', async () => {
const result = await homeRepo.searchAgents('Searchable Pinned');
diff --git a/packages/file-loaders/test/verilog-e2e.test.ts b/packages/file-loaders/test/verilog-e2e.test.ts
index 90f3eba768c..4a9379a71ba 100644
--- a/packages/file-loaders/test/verilog-e2e.test.ts
+++ b/packages/file-loaders/test/verilog-e2e.test.ts
@@ -11,8 +11,6 @@ import { join } from 'node:path';
import { loadFile } from '@lobechat/file-loaders';
import { afterAll, describe, expect, it } from 'vitest';
-import { isTextReadableFile } from '../src/utils/isTextReadableFile';
-
describe('T-331 E2E: loadFile extracts .v/.sv content for model context', () => {
const dir = mkdtempSync(join(tmpdir(), 't331-e2e-'));
@@ -71,9 +69,4 @@ endmodule
expect(doc.content).toContain('module alu_top');
expect(doc.content).toContain('always_comb');
});
-
- it('isTextReadableFile gate accepts v/sv (the parseFile dispatch decision)', () => {
- expect(isTextReadableFile('v')).toBe(true);
- expect(isTextReadableFile('sv')).toBe(true);
- });
});
diff --git a/packages/local-file-shell/src/contentSearch/__tests__/base.test.ts b/packages/local-file-shell/src/contentSearch/__tests__/base.test.ts
index 96ddb6f20c1..0f01a4f8c3b 100644
--- a/packages/local-file-shell/src/contentSearch/__tests__/base.test.ts
+++ b/packages/local-file-shell/src/contentSearch/__tests__/base.test.ts
@@ -330,20 +330,6 @@ describe('BaseContentSearch', () => {
});
});
- describe('checkToolAvailable', () => {
- it('should return true for nodejs', async () => {
- const available = await contentSearch.checkToolAvailable('nodejs');
-
- expect(available).toBe(true);
- });
-
- it('should return false for other tools', async () => {
- const available = await contentSearch.checkToolAvailable('rg');
-
- expect(available).toBe(false);
- });
- });
-
describe('setToolDetector', () => {
it('should set the tool detector manager', () => {
const mockManager = {} as any;
diff --git a/packages/local-file-shell/src/contentSearch/__tests__/enginePathParity.test.ts b/packages/local-file-shell/src/contentSearch/__tests__/enginePathParity.test.ts
index 9b77d42a79b..e32c9fd46fe 100644
--- a/packages/local-file-shell/src/contentSearch/__tests__/enginePathParity.test.ts
+++ b/packages/local-file-shell/src/contentSearch/__tests__/enginePathParity.test.ts
@@ -107,22 +107,6 @@ describe('content search engine parity', () => {
}
}, 60_000);
- it('does not hide a tracked directory whose name looks like build output', async () => {
- // Regression: a hardcoded `!**/build/**` made every engine skip this file,
- // even though git tracks it.
- const tracked = path.join(repo, 'build', 'entitlements.plist');
-
- for (const engine of engines) {
- const r = await search(engine, {
- output_mode: 'files_with_matches',
- pattern: 'needle',
- scope: repo,
- } as GrepContentParams);
-
- expect(r.matches, `${engine} hid a tracked build/ file`).toContain(tracked);
- }
- }, 60_000);
-
it('returns absolute paths from every engine', async () => {
for (const engine of engines) {
const r = await search(engine, {
diff --git a/packages/local-file-shell/src/fileSearch/__tests__/base.test.ts b/packages/local-file-shell/src/fileSearch/__tests__/base.test.ts
index 9e94ba0a998..f43ed702e5a 100644
--- a/packages/local-file-shell/src/fileSearch/__tests__/base.test.ts
+++ b/packages/local-file-shell/src/fileSearch/__tests__/base.test.ts
@@ -260,29 +260,4 @@ describe('BaseFileSearch', () => {
expect(results[0].engine).toBe('test-engine');
});
});
-
- describe('glob', () => {
- it('should return GlobFilesResult with engine', async () => {
- const result = await fileSearch.glob({ pattern: '*.ts' });
-
- expect(result.engine).toBe('test-engine');
- expect(result.success).toBe(true);
- });
- });
-
- describe('checkSearchServiceStatus', () => {
- it('should return true', async () => {
- const status = await fileSearch.checkSearchServiceStatus();
-
- expect(status).toBe(true);
- });
- });
-
- describe('updateSearchIndex', () => {
- it('should return true', async () => {
- const result = await fileSearch.updateSearchIndex();
-
- expect(result).toBe(true);
- });
- });
});
diff --git a/packages/model-runtime/src/const/type.test.ts b/packages/model-runtime/src/const/type.test.ts
deleted file mode 100644
index ee2608a41ea..00000000000
--- a/packages/model-runtime/src/const/type.test.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-import { ModelProvider } from 'model-bank';
-import { describe, expect, it } from 'vitest';
-
-describe('ModelProvider', () => {
- it('should be a valid enum object', () => {
- expect(typeof ModelProvider).toBe('object');
- expect(ModelProvider).not.toBeNull();
- });
-});
diff --git a/packages/model-runtime/src/core/streams/cloudflare.test.ts b/packages/model-runtime/src/core/streams/cloudflare.test.ts
index 93a72f49b68..5aac46a5304 100644
--- a/packages/model-runtime/src/core/streams/cloudflare.test.ts
+++ b/packages/model-runtime/src/core/streams/cloudflare.test.ts
@@ -192,13 +192,6 @@ describe('cloudflareHelpers', () => {
});
describe('desensitizeCloudflareUrl', () => {
- it('should mask account id in official API endpoint', () => {
- const url =
- 'https://api.cloudflare.com/client/v4/accounts/80009000a000b000c000d000e000f000/ai/run/';
- const maskedUrl = desensitizeCloudflareUrl(url);
- expect(maskedUrl).toBe('https://api.cloudflare.com/client/v4/accounts/****/ai/run/');
- });
-
it('should call desensitizeUrl for custom API endpoint', () => {
const url = 'https://custom.url/path';
vi.spyOn(desensitizeTool, 'desensitizeUrl').mockImplementation(
diff --git a/packages/model-runtime/src/errors/match.test.ts b/packages/model-runtime/src/errors/match.test.ts
index 5eb07f864b4..ad9b9b6c46d 100644
--- a/packages/model-runtime/src/errors/match.test.ts
+++ b/packages/model-runtime/src/errors/match.test.ts
@@ -229,14 +229,6 @@ describe('numericId contract', () => {
}
});
- it('spec entries appear in source order sorted by numericId', () => {
- // JS object keys preserve insertion order — this guard prevents future
- // additions from being wedged into the wrong section.
- const ids = specs.map((s) => s.numericId);
- const sortedIds = [...ids].sort((a, b) => a - b);
- expect(ids).toEqual(sortedIds);
- });
-
it('tier digit is 0 (OSS) or the cloud digit', () => {
for (const spec of specs) {
const tier = Math.floor(spec.numericId / 100) % 10;
diff --git a/packages/model-runtime/src/providers/ai360/index.test.ts b/packages/model-runtime/src/providers/ai360/index.test.ts
index 54a6a53ec99..db712e2d6e4 100644
--- a/packages/model-runtime/src/providers/ai360/index.test.ts
+++ b/packages/model-runtime/src/providers/ai360/index.test.ts
@@ -55,22 +55,6 @@ describe('LobeAi360AI - custom features', () => {
});
});
- it('should correctly set web_search properties', () => {
- const payload = {
- messages: [{ content: 'Hello', role: 'user' }],
- model: '360gpt-pro',
- enabledSearch: true,
- } as any;
-
- const result = params.chatCompletion.handlePayload!(payload);
- const webSearchTool = result.tools?.find((tool: any) => tool.type === 'web_search');
-
- expect(webSearchTool).toBeDefined();
- expect(webSearchTool.type).toBe('web_search');
- expect(webSearchTool.web_search).toBeDefined();
- expect(webSearchTool.web_search.search_mode).toBe('auto');
- });
-
it('should not add web_search tool when enabledSearch is false', () => {
const payload = {
messages: [{ content: 'Hello', role: 'user' }],
@@ -652,27 +636,6 @@ describe('LobeAi360AI - custom features', () => {
expect(model.reasoning).toBe(true);
});
- it('should prioritize functionCall from model ID check over knownModel', async () => {
- const mockClient = {
- models: {
- list: vi.fn().mockResolvedValue({
- data: [
- {
- id: '360gpt-pro',
- max_tokens: 4096,
- total_tokens: 8192,
- },
- ],
- }),
- },
- };
-
- const models = await params.models!({ client: mockClient as any });
- const model = models[0];
-
- expect(model.functionCall).toBe(true);
- });
-
it('should merge multiple capabilities correctly', async () => {
const mockClient = {
models: {
diff --git a/packages/model-runtime/src/providers/cohere/index.test.ts b/packages/model-runtime/src/providers/cohere/index.test.ts
index af88319fdbf..095d43da5e2 100644
--- a/packages/model-runtime/src/providers/cohere/index.test.ts
+++ b/packages/model-runtime/src/providers/cohere/index.test.ts
@@ -617,27 +617,6 @@ describe('LobeCohereAI - custom features', () => {
expect(models[0].contextWindowTokens).toBe(0);
});
- it('should merge vision capability from both API and known model list', async () => {
- mockClient.models.list.mockResolvedValue({
- body: {
- models: [
- {
- name: 'command-r-plus-08-2024',
- context_length: 128000,
- features: ['tools', 'chat'],
- supports_vision: true,
- },
- ],
- },
- });
-
- const models = await params.models({ client: mockClient as any });
-
- expect(models).toHaveLength(1);
- // Vision should be true from either API or known model list
- expect(models[0].vision).toBe(true);
- });
-
it('should correctly filter and map all model fields', async () => {
mockClient.models.list.mockResolvedValue({
body: {
@@ -704,14 +683,6 @@ describe('LobeCohereAI - custom features', () => {
});
describe('chatCompletion configuration', () => {
- it('should have excludeUsage set to true', () => {
- expect(params.chatCompletion.excludeUsage).toBe(true);
- });
-
- it('should have noUserId set to true', () => {
- expect(params.chatCompletion.noUserId).toBe(true);
- });
-
it('should have handlePayload function', () => {
expect(params.chatCompletion.handlePayload).toBeDefined();
expect(typeof params.chatCompletion.handlePayload).toBe('function');
diff --git a/packages/model-runtime/src/providers/cometapi/index.test.ts b/packages/model-runtime/src/providers/cometapi/index.test.ts
index b8535de944b..f034dae4630 100644
--- a/packages/model-runtime/src/providers/cometapi/index.test.ts
+++ b/packages/model-runtime/src/providers/cometapi/index.test.ts
@@ -335,24 +335,6 @@ describe('LobeCometAPIAI - custom features', () => {
// processMultiProviderModelList should handle different providers
});
- it('should merge with known model data from model-bank', async () => {
- const mockClient = {
- apiKey: 'test',
- baseURL: 'https://api.cometapi.com/v1',
- models: {
- list: vi.fn().mockResolvedValue({
- data: [{ id: 'gpt-3.5-turbo', object: 'model', owned_by: 'openai' }],
- }),
- },
- };
-
- const models = await params.models!({ client: mockClient as any });
- const model = models[0];
-
- // Should have properties from both API and model-bank
- expect(model.id).toBe('gpt-3.5-turbo');
- });
-
it('should handle models not in model-bank', async () => {
const mockClient = {
apiKey: 'test',
diff --git a/packages/model-runtime/src/providers/deepseek/__tests__/modelFetch.test.ts b/packages/model-runtime/src/providers/deepseek/__tests__/modelFetch.test.ts
index 550132a8d60..75a9d9e6cd9 100644
--- a/packages/model-runtime/src/providers/deepseek/__tests__/modelFetch.test.ts
+++ b/packages/model-runtime/src/providers/deepseek/__tests__/modelFetch.test.ts
@@ -55,18 +55,6 @@ describe('DeepSeek models', () => {
expect(models).toEqual([]);
});
- it('should process models with MODEL_LIST_CONFIGS', async () => {
- mockClient.models.list.mockResolvedValue({
- data: [{ id: 'deepseek-chat' }],
- });
-
- const models = await fetchModels({ client: mockClient });
-
- // The processModelList function should merge with known model list
- expect(models[0]).toHaveProperty('id');
- expect(models[0].id).toBe('deepseek-chat');
- });
-
it('should preserve model properties from API response', async () => {
mockClient.models.list.mockResolvedValue({
data: [
diff --git a/packages/model-runtime/src/providers/giteeai/index.test.ts b/packages/model-runtime/src/providers/giteeai/index.test.ts
index 1eaa471305b..cca4d2c13d0 100644
--- a/packages/model-runtime/src/providers/giteeai/index.test.ts
+++ b/packages/model-runtime/src/providers/giteeai/index.test.ts
@@ -170,26 +170,5 @@ describe('LobeGiteeAI - custom features', () => {
expect(mockClient.models.list).toHaveBeenCalledTimes(1);
});
-
- it('should pass correct client to processMultiProviderModelList', async () => {
- const mockModelList = [
- { id: 'deepseek-r1', object: 'model' },
- { id: 'qwen-plus', object: 'model' },
- ];
-
- const mockClient = {
- apiKey: 'test_api_key',
- baseURL: 'https://ai.gitee.com/v1',
- models: {
- list: vi.fn().mockResolvedValue({ data: mockModelList }),
- },
- } as any;
-
- const models = await params.models!({ client: mockClient });
-
- // Verify processMultiProviderModelList was called with correct parameters
- expect(models).toBeDefined();
- expect(Array.isArray(models)).toBe(true);
- });
});
});
diff --git a/packages/model-runtime/src/providers/google/thinkingResolver.test.ts b/packages/model-runtime/src/providers/google/thinkingResolver.test.ts
index 761acfaed73..9fab76de03e 100644
--- a/packages/model-runtime/src/providers/google/thinkingResolver.test.ts
+++ b/packages/model-runtime/src/providers/google/thinkingResolver.test.ts
@@ -529,8 +529,6 @@ describe('resolveGoogleThinkingBudget', () => {
it('supports disabling and dynamic thinking for flash models', () => {
expect(resolveGoogleThinkingBudget('gemini-2.5-flash')).toBe(-1);
- expect(resolveGoogleThinkingBudget('gemini-2.5-flash', 0)).toBe(0);
- expect(resolveGoogleThinkingBudget('gemini-2.5-flash', -1)).toBe(-1);
expect(resolveGoogleThinkingBudget('gemini-2.5-flash', -5)).toBe(0);
expect(resolveGoogleThinkingBudget('gemini-2.5-flash-preview', 30_000)).toBe(24_576);
});
diff --git a/packages/model-runtime/src/providers/internlm/index.test.ts b/packages/model-runtime/src/providers/internlm/index.test.ts
index 101fa0675d9..a5683993317 100644
--- a/packages/model-runtime/src/providers/internlm/index.test.ts
+++ b/packages/model-runtime/src/providers/internlm/index.test.ts
@@ -259,62 +259,5 @@ describe('LobeInternLMAI - custom features', () => {
expect(models.length).toBe(1);
expect(models[0].id).toBe('valid-model');
});
-
- it('should set contextWindowTokens from known model', async () => {
- const mockClient = {
- baseURL: 'https://chat.intern-ai.org.cn/api/v1',
- apiKey: 'test',
- models: {
- list: vi.fn().mockResolvedValue({
- data: [{ id: 'internlm2_5-7b-chat' }],
- }),
- },
- };
-
- const models = await params.models!({ client: mockClient as any });
- const model = models[0];
-
- // Should have contextWindowTokens from model-bank if available
- expect(model.id).toBe('internlm2_5-7b-chat');
- });
-
- it('should set displayName from known model', async () => {
- const mockClient = {
- baseURL: 'https://chat.intern-ai.org.cn/api/v1',
- apiKey: 'test',
- models: {
- list: vi.fn().mockResolvedValue({
- data: [{ id: 'internlm2_5-7b-chat' }],
- }),
- },
- };
-
- const models = await params.models!({ client: mockClient as any });
- const model = models[0];
-
- // Should have displayName from model-bank if available
- expect(model.id).toBe('internlm2_5-7b-chat');
- });
-
- it('should combine keyword detection with known model abilities', async () => {
- const mockClient = {
- baseURL: 'https://chat.intern-ai.org.cn/api/v1',
- apiKey: 'test',
- models: {
- list: vi.fn().mockResolvedValue({
- data: [{ id: 'internlm2_5-7b-chat' }, { id: 'internvl-chat-2b' }],
- }),
- },
- };
-
- const models = await params.models!({ client: mockClient as any });
-
- // Models with matching keywords should have abilities set to true
- const internlmModel = models.find((m) => m.id === 'internlm2_5-7b-chat');
- const internvlModel = models.find((m) => m.id === 'internvl-chat-2b');
-
- expect(internlmModel?.functionCall).toBe(true);
- expect(internvlModel?.vision).toBe(true);
- });
});
});
diff --git a/packages/model-runtime/src/providers/lmstudio/index.test.ts b/packages/model-runtime/src/providers/lmstudio/index.test.ts
index 7b4bad83cb8..d4a74281455 100644
--- a/packages/model-runtime/src/providers/lmstudio/index.test.ts
+++ b/packages/model-runtime/src/providers/lmstudio/index.test.ts
@@ -98,19 +98,6 @@ describe('LobeLMStudioAI - custom features', () => {
expect(models).toBeDefined();
});
- it('should merge abilities from known models', async () => {
- const mockClient = {
- models: {
- list: vi.fn().mockResolvedValue({
- data: [{ id: 'gpt-4' }],
- }),
- },
- };
-
- const models = await params.models!({ client: mockClient as any });
- expect(models).toBeDefined();
- });
-
it('should set enabled to false when not in known models', async () => {
const mockClient = {
models: {
diff --git a/packages/model-runtime/src/providers/moonshot/index.reasoningEffort.test.ts b/packages/model-runtime/src/providers/moonshot/index.reasoningEffort.test.ts
index e409da99461..82bda046732 100644
--- a/packages/model-runtime/src/providers/moonshot/index.reasoningEffort.test.ts
+++ b/packages/model-runtime/src/providers/moonshot/index.reasoningEffort.test.ts
@@ -49,7 +49,7 @@ describe('LobeMoonshotAnthropicAI reasoning effort', () => {
},
);
- it.each(['low', 'high', 'max'])('should forward %s reasoning effort', async (effort) => {
+ it.each(['high', 'max'])('should forward %s reasoning effort', async (effort) => {
await instance.chat({
messages: [{ content: 'Hello', role: 'user' }],
model: 'kimi-k3.1-pro',
diff --git a/packages/model-runtime/src/providers/ollama/index.test.ts b/packages/model-runtime/src/providers/ollama/index.test.ts
index 067e51fd183..156029c7778 100644
--- a/packages/model-runtime/src/providers/ollama/index.test.ts
+++ b/packages/model-runtime/src/providers/ollama/index.test.ts
@@ -1,5 +1,4 @@
// @vitest-environment node
-import { imageUrlToBase64 } from '../../utils/imageToBase64';
import { ModelProvider } from 'model-bank';
import { Ollama } from 'ollama/browser';
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
@@ -7,6 +6,7 @@ import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
import { AgentRuntimeErrorType } from '../../types/error';
import { AgentRuntimeError } from '../../utils/createError';
import * as debugStreamModule from '../../utils/debugStream';
+import { imageUrlToBase64 } from '../../utils/imageToBase64';
import { LobeOllamaAI, params } from './index';
vi.mock('ollama/browser');
@@ -631,26 +631,6 @@ describe('LobeOllamaAI', () => {
});
});
- it('should handle content with only images (no text)', async () => {
- const message = {
- content: [
- {
- type: 'image_url',
- image_url: { url: 'data:image/png;base64,abc123' },
- },
- ],
- role: 'user',
- };
-
- const ollamaMessage = await ollamaAI['convertContentToOllamaMessage'](message as any);
-
- expect(ollamaMessage).toEqual({
- content: '',
- role: 'user',
- images: ['abc123'],
- });
- });
-
it('should handle multiple images without text', async () => {
const message = {
content: [
diff --git a/packages/model-runtime/src/providers/qwen/createImage.test.ts b/packages/model-runtime/src/providers/qwen/createImage.test.ts
index a79d5e51ae5..db3ea32ca80 100644
--- a/packages/model-runtime/src/providers/qwen/createImage.test.ts
+++ b/packages/model-runtime/src/providers/qwen/createImage.test.ts
@@ -803,23 +803,6 @@ describe('createQwenImage', () => {
}),
);
});
-
- it('should throw error when imageUrl is not provided', async () => {
- const payload: CreateImagePayload = {
- model: 'qwen-image-edit',
- params: {
- prompt: 'Edit this image',
- // imageUrl not provided
- },
- };
-
- await expect(createQwenImage(payload, mockOptions)).rejects.toEqual(
- expect.objectContaining({
- errorType: 'ProviderBizError',
- provider: 'qwen',
- }),
- );
- });
});
describe('new image-generation route coverage', () => {
diff --git a/packages/model-runtime/src/providers/search1api/index.test.ts b/packages/model-runtime/src/providers/search1api/index.test.ts
index cf778cc5686..3eae73ef672 100644
--- a/packages/model-runtime/src/providers/search1api/index.test.ts
+++ b/packages/model-runtime/src/providers/search1api/index.test.ts
@@ -318,20 +318,6 @@ describe('LobeSearch1API - custom features', () => {
expect.anything(),
);
});
- it('should handle edge case temperature exactly at 2', async () => {
- await instance.chat({
- messages: [{ content: 'Hello', role: 'user' }],
- model: 'gpt-4o-mini',
- temperature: 2,
- });
-
- expect(instance['client'].chat.completions.create).toHaveBeenCalledWith(
- expect.objectContaining({
- temperature: undefined,
- }),
- expect.anything(),
- );
- });
it('should handle negative presence_penalty', async () => {
await instance.chat({
@@ -838,17 +824,6 @@ describe('LobeSearch1API - custom features', () => {
});
});
- it('should handle function call models correctly', async () => {
- mockClient.models.list.mockResolvedValue({
- data: [{ id: 'gpt-4o-mini' }],
- });
-
- const models = await params.models({ client: mockClient as any });
-
- expect(models).toHaveLength(1);
- expect(models[0].functionCall).toBe(true);
- });
-
it('should handle models with whitespace in id', async () => {
mockClient.models.list.mockResolvedValue({
data: [
diff --git a/packages/model-runtime/src/providers/stepfun/index.test.ts b/packages/model-runtime/src/providers/stepfun/index.test.ts
index 01274fb113a..49efe7589e1 100644
--- a/packages/model-runtime/src/providers/stepfun/index.test.ts
+++ b/packages/model-runtime/src/providers/stepfun/index.test.ts
@@ -218,19 +218,6 @@ describe('LobeStepfunAI - custom features', () => {
expect(models).toBeDefined();
});
- it('should merge abilities from known models', async () => {
- const mockClient = {
- models: {
- list: vi.fn().mockResolvedValue({
- data: [{ id: 'step-1-8k' }],
- }),
- },
- };
-
- const models = await params.models!({ client: mockClient as any });
- expect(models).toBeDefined();
- });
-
it('should handle empty model list', async () => {
const mockClient = {
models: {
diff --git a/packages/model-runtime/src/providers/v0/index.test.ts b/packages/model-runtime/src/providers/v0/index.test.ts
index a77f0e1a0f3..aadeb998599 100644
--- a/packages/model-runtime/src/providers/v0/index.test.ts
+++ b/packages/model-runtime/src/providers/v0/index.test.ts
@@ -170,26 +170,5 @@ describe('LobeV0AI - custom features', () => {
expect(mockClient.models.list).toHaveBeenCalledTimes(1);
});
-
- it('should pass correct client to processModelList', async () => {
- const mockModelList = [
- { id: 'gpt-4o', object: 'model' },
- { id: 'gpt-4o-mini', object: 'model' },
- ];
-
- const mockClient = {
- apiKey: 'test_api_key',
- baseURL: 'https://api.v0.dev/v1',
- models: {
- list: vi.fn().mockResolvedValue({ data: mockModelList }),
- },
- } as any;
-
- const models = await params.models!({ client: mockClient });
-
- // Verify processModelList was called with correct parameters
- expect(models).toBeDefined();
- expect(Array.isArray(models)).toBe(true);
- });
});
});
diff --git a/packages/model-runtime/src/providers/xiaomimimo/index.test.ts b/packages/model-runtime/src/providers/xiaomimimo/index.test.ts
index 4b099056a53..ab480a41983 100644
--- a/packages/model-runtime/src/providers/xiaomimimo/index.test.ts
+++ b/packages/model-runtime/src/providers/xiaomimimo/index.test.ts
@@ -333,18 +333,6 @@ describe('LobeXiaomiMiMoAI - custom features', () => {
expect(models).toEqual([]);
});
- it('should process models with MODEL_LIST_CONFIGS', async () => {
- mockClient.models.list.mockResolvedValue({
- data: [{ id: 'mimo-v2-pro' }],
- });
-
- const models = await params.models({ client: mockClient as any });
-
- // The processModelList function should merge with known model list
- expect(models[0]).toHaveProperty('id');
- expect(models[0].id).toBe('mimo-v2-pro');
- });
-
it('should preserve model properties from API response', async () => {
mockClient.models.list.mockResolvedValue({
data: [
diff --git a/packages/model-runtime/src/providers/zenmux/index.test.ts b/packages/model-runtime/src/providers/zenmux/index.test.ts
index 558e476f98d..bec970ede3b 100644
--- a/packages/model-runtime/src/providers/zenmux/index.test.ts
+++ b/packages/model-runtime/src/providers/zenmux/index.test.ts
@@ -34,20 +34,6 @@ describe('ZenMux Runtime', () => {
delete process.env.DEBUG_ZENMUX_CHAT_COMPLETION;
});
- describe('Debug Configuration', () => {
- it('should return false when DEBUG_ZENMUX_CHAT_COMPLETION is not set', () => {
- delete process.env.DEBUG_ZENMUX_CHAT_COMPLETION;
- const debugResult = process.env.DEBUG_ZENMUX_CHAT_COMPLETION === '1';
- expect(debugResult).toBe(false);
- });
-
- it('should return true when DEBUG_ZENMUX_CHAT_COMPLETION is set to 1', () => {
- process.env.DEBUG_ZENMUX_CHAT_COMPLETION = '1';
- const debugResult = process.env.DEBUG_ZENMUX_CHAT_COMPLETION === '1';
- expect(debugResult).toBe(true);
- });
- });
-
describe('LobeZenMuxAI - custom features', () => {
describe('Params Export', () => {
it('should have correct provider ID', () => {
diff --git a/packages/model-runtime/src/providers/zeroone/index.test.ts b/packages/model-runtime/src/providers/zeroone/index.test.ts
index 0b8682ae428..37b05ab8ba9 100644
--- a/packages/model-runtime/src/providers/zeroone/index.test.ts
+++ b/packages/model-runtime/src/providers/zeroone/index.test.ts
@@ -170,26 +170,5 @@ describe('LobeZeroOneAI - custom features', () => {
expect(mockClient.models.list).toHaveBeenCalledTimes(1);
});
-
- it('should pass correct client to processModelList', async () => {
- const mockModelList = [
- { id: 'yi-34b-chat-0205', object: 'model' },
- { id: 'yi-lightning', object: 'model' },
- ];
-
- const mockClient = {
- apiKey: 'test_api_key',
- baseURL: 'https://api.lingyiwanwu.com/v1',
- models: {
- list: vi.fn().mockResolvedValue({ data: mockModelList }),
- },
- } as any;
-
- const models = await params.models!({ client: mockClient });
-
- // Verify processModelList was called with correct parameters
- expect(models).toBeDefined();
- expect(Array.isArray(models)).toBe(true);
- });
});
});
diff --git a/packages/model-runtime/src/utils/getFallbackModelProperty.test.ts b/packages/model-runtime/src/utils/getFallbackModelProperty.test.ts
index 4293b787b6b..d2381eb1f3e 100644
--- a/packages/model-runtime/src/utils/getFallbackModelProperty.test.ts
+++ b/packages/model-runtime/src/utils/getFallbackModelProperty.test.ts
@@ -221,12 +221,6 @@ describe('getModelPropertyWithFallback', () => {
expect(openaiResult).toBe('GPT-4');
expect(azureResult).toBe('GPT-4 Azure');
});
-
- it('should fall back to first match when specified provider not found', async () => {
- // When asking for 'fake-provider', should fall back to first match (openai)
- const result = await getModelPropertyWithFallback('gpt-4', 'displayName', 'fake-provider');
- expect(result).toBe('GPT-4');
- });
});
describe('property existence handling', () => {
@@ -236,12 +230,6 @@ describe('getModelPropertyWithFallback', () => {
expect(result).toBeUndefined();
});
- it('should handle properties that exist but have falsy values', async () => {
- // claude-3 has enabled: false
- const result = await getModelPropertyWithFallback('claude-3', 'enabled');
- expect(result).toBe(false);
- });
-
it('should distinguish between undefined and null values', async () => {
// Testing that we check for undefined specifically, not just falsy values
const result = await getModelPropertyWithFallback('claude-3', 'contextWindowTokens');
diff --git a/packages/model-runtime/src/utils/modelExtendParams.test.ts b/packages/model-runtime/src/utils/modelExtendParams.test.ts
index 31a38e2c615..5f9556d79a8 100644
--- a/packages/model-runtime/src/utils/modelExtendParams.test.ts
+++ b/packages/model-runtime/src/utils/modelExtendParams.test.ts
@@ -445,9 +445,6 @@ describe('resolveDefaultThinkingLevelForModel', () => {
);
expect(resolveDefaultThinkingLevelForModel('gemini-flash-lite-latest')).toBe('minimal');
expect(resolveDefaultThinkingLevelForModel('gemini-3.6-flash')).toBe('medium');
- expect(resolveDefaultThinkingLevelForModel('gemini-3.7-flash', 'thinkingLevel3')).toBe(
- 'medium',
- );
expect(resolveDefaultThinkingLevelForModel('gemini-3.5-flash')).toBe('medium');
expect(resolveDefaultThinkingLevelForModel('gemini-3.5-flash-lite')).toBe('minimal');
expect(resolveDefaultThinkingLevelForModel('gemini-3.1-flash-lite')).toBe('minimal');
diff --git a/packages/model-runtime/src/utils/modelParse.test.ts b/packages/model-runtime/src/utils/modelParse.test.ts
index 616b037e0fa..661b54fcb9c 100644
--- a/packages/model-runtime/src/utils/modelParse.test.ts
+++ b/packages/model-runtime/src/utils/modelParse.test.ts
@@ -187,14 +187,6 @@ describe('modelParse', () => {
});
});
- // New sanity tests for your added config
- describe('MODEL_LIST_CONFIGS sanity', () => {
- it('google.imageOutputKeywords should include "-image-" for image-output capability inference', () => {
- expect(MODEL_LIST_CONFIGS.google.imageOutputKeywords).toBeDefined();
- expect(MODEL_LIST_CONFIGS.google.imageOutputKeywords).toContain('-image-');
- });
- });
-
describe('processModelList', () => {
it('should process a list of models with the given provider config', async () => {
const modelList = [{ id: 'gpt-4o' }, { id: 'gpt-3.5-turbo' }];
diff --git a/packages/model-runtime/src/utils/postProcessModelList.test.ts b/packages/model-runtime/src/utils/postProcessModelList.test.ts
index bf64aca161d..4efc71e7a02 100644
--- a/packages/model-runtime/src/utils/postProcessModelList.test.ts
+++ b/packages/model-runtime/src/utils/postProcessModelList.test.ts
@@ -1,11 +1,10 @@
import type { ChatModelCard } from '@lobechat/types';
-import type { AiModelType } from 'model-bank';
import type * as ModelBankModule from 'model-bank';
+import type { AiModelType } from 'model-bank';
import { describe, expect, it, vi } from 'vitest';
import {
appendDecisionModels,
- IMAGE_GENERATION_MODEL_WHITELIST,
isAutoGeneratedDecisionModelId,
isAutoGeneratedImageModelId,
postProcessModelList,
@@ -24,13 +23,6 @@ vi.mock('model-bank', async (importOriginal) => {
};
});
-describe('IMAGE_GENERATION_MODEL_WHITELIST', () => {
- it('should contain expected whitelisted models', () => {
- expect(IMAGE_GENERATION_MODEL_WHITELIST).toContain('gemini-2.5-flash-image-preview');
- expect(IMAGE_GENERATION_MODEL_WHITELIST).toContain('gemini-2.5-flash-image-preview:free');
- });
-});
-
describe('isAutoGeneratedImageModelId', () => {
it('should identify image model ids generated from whitelisted base models', () => {
expect(isAutoGeneratedImageModelId('gemini-3.1-flash-image-preview:image')).toBe(true);
diff --git a/packages/prompts/src/prompts/fileSystem/formatCommandResult.test.ts b/packages/prompts/src/prompts/fileSystem/formatCommandResult.test.ts
index 323889f5237..b4933d675ae 100644
--- a/packages/prompts/src/prompts/fileSystem/formatCommandResult.test.ts
+++ b/packages/prompts/src/prompts/fileSystem/formatCommandResult.test.ts
@@ -30,11 +30,6 @@ describe('formatCommandResult', () => {
`);
});
- it('should not mark empty output while the command is still running', () => {
- const result = formatCommandResult({ shellId: 'shell-123', success: true });
- expect(result).not.toContain('(no output)');
- });
-
it('should format still-running command', () => {
const result = formatCommandResult({
shellId: 'shell-123',
diff --git a/packages/tool-runtime/src/__tests__/LocalSystemExecutionRuntime.test.ts b/packages/tool-runtime/src/__tests__/LocalSystemExecutionRuntime.test.ts
index eaded5639fe..1482a61b138 100644
--- a/packages/tool-runtime/src/__tests__/LocalSystemExecutionRuntime.test.ts
+++ b/packages/tool-runtime/src/__tests__/LocalSystemExecutionRuntime.test.ts
@@ -51,7 +51,6 @@ describe('LocalSystemExecutionRuntime.editFile', () => {
);
// The model reads `content`; it must still carry the real reason.
expect(output.content).toBe('The specified old_string was not found in the file');
- expect(output.content).not.toContain('UNKNOWN_EXEC_ERROR');
expect((output.state as { replacements: number }).replacements).toBe(0);
});
@@ -317,7 +316,6 @@ describe('LocalSystemExecutionRuntime.readFile', () => {
const output = await runtime.readFile({ endLine: 2545, path: '/tmp/big.txt', startLine: 2500 });
expect(output.content).toBe('2501 tail');
- expect(output.content).not.toContain('(lines');
});
it('prefixes each content line with its 1-based line number', async () => {
diff --git a/packages/trpc/src/lambda/context.test.ts b/packages/trpc/src/lambda/context.test.ts
index 14c38921e83..fb8ed4785c3 100644
--- a/packages/trpc/src/lambda/context.test.ts
+++ b/packages/trpc/src/lambda/context.test.ts
@@ -198,12 +198,6 @@ describe('createContextInner', () => {
expect(context2.resHeaders).toBeInstanceOf(Headers);
});
- it('should always provide resHeaders', async () => {
- const ctx = await createContextInner();
-
- expect(ctx.resHeaders).toBeInstanceOf(Headers);
- });
-
it('should keep provided traceContext', async () => {
const traceContext = { test: 'ctx' } as any;
const ctx = await createContextInner({ traceContext });
diff --git a/packages/utils/src/server/__tests__/sse.test.ts b/packages/utils/src/server/__tests__/sse.test.ts
index 2488c5730d8..b10041279fe 100644
--- a/packages/utils/src/server/__tests__/sse.test.ts
+++ b/packages/utils/src/server/__tests__/sse.test.ts
@@ -328,26 +328,4 @@ describe('createSSEHeaders', () => {
'X-Accel-Buffering': 'no',
});
});
-
- it('should include CORS headers', () => {
- const headers = createSSEHeaders() as Record<string, string>;
-
- expect(headers['Access-Control-Allow-Origin']).toBe('*');
- expect(headers['Access-Control-Allow-Methods']).toBe('GET');
- expect(headers['Access-Control-Allow-Headers']).toBe('Cache-Control, Last-Event-ID');
- });
-
- it('should include cache control headers', () => {
- const headers = createSSEHeaders() as Record<string, string>;
-
- expect(headers['Cache-Control']).toBe('no-cache, no-transform');
- });
-
- it('should include SSE-specific headers', () => {
- const headers = createSSEHeaders() as Record<string, string>;
-
- expect(headers['Content-Type']).toBe('text/event-stream');
- expect(headers['Connection']).toBe('keep-alive');
- expect(headers['X-Accel-Buffering']).toBe('no');
- });
});
diff --git a/packages/utils/src/videoToBase64.test.ts b/packages/utils/src/videoToBase64.test.ts
index d83aebc516d..c7817bb38d2 100644
--- a/packages/utils/src/videoToBase64.test.ts
+++ b/packages/utils/src/videoToBase64.test.ts
@@ -150,27 +150,4 @@ describe('videoUrlToBase64', () => {
consoleErrorSpy.mockRestore();
});
-
- it('should use 30 second timeout', async () => {
- const mockArrayBuffer = new ArrayBuffer(16);
- const mockResponse = {
- ok: true,
- status: 200,
- headers: {
- get: vi.fn().mockReturnValue('video/mp4'),
- },
- arrayBuffer: vi.fn().mockResolvedValue(mockArrayBuffer),
- };
-
- mockSsrfSafeFetch.mockResolvedValue(mockResponse);
-
- await videoUrlToBase64('https://example.com/video.mp4');
-
- expect(mockSsrfSafeFetch).toHaveBeenCalledWith(
- 'https://example.com/video.mp4',
- expect.objectContaining({
- signal: expect.any(AbortSignal),
- }),
- );
- });
});
diff --git a/scripts/stylexMigration/legacyFiles.test.ts b/scripts/stylexMigration/legacyFiles.test.ts
index 96f7a9633d9..9c599b9b0f3 100644
--- a/scripts/stylexMigration/legacyFiles.test.ts
+++ b/scripts/stylexMigration/legacyFiles.test.ts
@@ -1,7 +1,7 @@
// @vitest-environment node
import { describe, expect, it } from 'vitest';
-import { findStaleLegacyFiles, readLegacyFiles, scanRepo } from '.';
+import { findStaleLegacyFiles, scanRepo } from '.';
describe('legacyFiles.json', () => {
it('lists only files that still import emotion styles', () => {
@@ -11,9 +11,4 @@ describe('legacyFiles.json', () => {
// bun run stylex:migration --prune-legacy
expect(stale).toEqual([]);
});
-
- it('stays sorted so pruning diffs only remove lines', () => {
- const legacy = readLegacyFiles();
- expect(legacy).toEqual([...legacy].sort());
- });
});
diff --git a/src/app/(backend)/api/agent/stream/__tests__/route.test.ts b/src/app/(backend)/api/agent/stream/__tests__/route.test.ts
index 03be7fd0e46..99b8b37a953 100644
--- a/src/app/(backend)/api/agent/stream/__tests__/route.test.ts
+++ b/src/app/(backend)/api/agent/stream/__tests__/route.test.ts
@@ -787,8 +787,6 @@ data: {"type":"stream_end","timestamp":300,"operationId":"test-operation","data"
// This should not throw - verifies the callback can handle the event
expect(() => capturedCallback!([endEvent])).not.toThrow();
- // Signal should be aborted (connection closed)
- expect(capturedSignal!.aborted).toBe(true);
});
it('should handle agent_runtime_end event in callback without errors', async () => {
diff --git a/src/features/AgentIdentityModal/useAgentIdentityForm.test.ts b/src/features/AgentIdentityModal/useAgentIdentityForm.test.ts
index fd3e35736e6..7f082234ac2 100644
--- a/src/features/AgentIdentityModal/useAgentIdentityForm.test.ts
+++ b/src/features/AgentIdentityModal/useAgentIdentityForm.test.ts
@@ -119,29 +119,6 @@ describe('useAgentIdentityForm', () => {
);
});
- it('routes identity changes through the optimistic sidebar projection', async () => {
- const { result } = setup();
-
- act(() => result.current.setName('小艾'));
- await act(async () => {
- await result.current.save();
- });
-
- expect(mocks.updateAgentMeta).toHaveBeenCalledOnce();
- });
-
- it('does not refresh the sidebar when the save was rejected', async () => {
- mocks.updateAgentSlug.mockResolvedValue({ reason: 'taken', success: false });
- const { result } = setup();
-
- act(() => result.current.setSlug('taken-slug'));
- await act(async () => {
- await result.current.save();
- });
-
- expect(mocks.updateAgentMeta).not.toHaveBeenCalled();
- });
-
it('routes a slug change to its own endpoint, normalized to lowercase', async () => {
const { result, onSaved } = setup();
diff --git a/src/features/AgentProfileTabs/tabOptions.test.ts b/src/features/AgentProfileTabs/tabOptions.test.ts
index f7150683ccf..1e4c60ddfcc 100644
--- a/src/features/AgentProfileTabs/tabOptions.test.ts
+++ b/src/features/AgentProfileTabs/tabOptions.test.ts
@@ -32,7 +32,7 @@ describe('buildAgentProfileTabOptions', () => {
]);
});
- it('allows configuring channels even when the agent needs a device to execute', () => {
+ it('keeps configuration tabs when sharing is unsupported', () => {
const options = buildAgentProfileTabOptions({
active: 'profile',
canConfigure: true,
@@ -65,17 +65,6 @@ describe('buildAgentProfileTabOptions', () => {
expect(options.map((option) => option.value)).toEqual(['channel', 'statistics']);
});
- it('drops share when the agent cannot be shared at all', () => {
- const options = buildAgentProfileTabOptions({
- active: 'profile',
- canConfigure: true,
- labels,
- shareSupported: false,
- });
-
- expect(options.map((option) => option.value)).toEqual(['profile', 'channel', 'statistics']);
- });
-
it('keeps share when it owns the current page even though it is gated off', () => {
const options = buildAgentProfileTabOptions({
active: 'share',
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx
index d7ff1f2e544..595d3af7f16 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TaskAcceptance.test.tsx
@@ -435,25 +435,4 @@ describe('TaskAcceptance', () => {
expect(screen.getByText('Current check')).toBeInTheDocument();
expect(screen.getByText('Removed check')).toBeInTheDocument();
});
-
- it('groups a checklist only after it exceeds ten checks', () => {
- mocks.acceptanceSubject = { id: 'acceptance-1' };
- mocks.bundle = {
- acceptance: { id: 'acceptance-1', requirement: 'Everything is verifiable.' },
- checks: Array.from({ length: 11 }, (_, index) => ({
- category: index < 6 ? 'Setup' : 'Result',
- id: `c${index + 1}`,
- seq: index + 1,
- title: `Check ${index + 1}`,
- })),
- isOwner: true,
- };
-
- render(<TaskAcceptance />);
-
- expect(screen.getByText('Setup')).toBeInTheDocument();
- expect(screen.getByText('Result')).toBeInTheDocument();
- expect(screen.getByText('taskDetail.acceptance.collapseAll')).toBeInTheDocument();
- expect(screen.getByText('Check 11')).toBeInTheDocument();
- });
});
diff --git a/src/features/AgentTasks/AgentTaskDetail/TaskDetailHeaderActions.test.tsx b/src/features/AgentTasks/AgentTaskDetail/TaskDetailHeaderActions.test.tsx
index 30410d69f9a..0872cc8a67e 100644
--- a/src/features/AgentTasks/AgentTaskDetail/TaskDetailHeaderActions.test.tsx
+++ b/src/features/AgentTasks/AgentTaskDetail/TaskDetailHeaderActions.test.tsx
@@ -155,13 +155,6 @@ describe('TaskDetailHeaderActions', () => {
]);
});
- it('includes task transfer and copy actions in the detail menu', () => {
- render(<TaskDetailHeaderActions />);
-
- expect(mocks.dropdownItems.map((item) => item?.key)).toContain('transfer-task');
- expect(mocks.dropdownItems.map((item) => item?.key)).toContain('copy-task');
- });
-
it('shows "publish to workspace" only for private tasks inside a workspace', () => {
render(<TaskDetailHeaderActions />);
diff --git a/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.test.tsx b/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.test.tsx
index 2eb2565277b..5d43f2c7fb6 100644
--- a/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.test.tsx
+++ b/src/features/AgentTasks/AgentTaskList/CreateTaskInlineEntry.test.tsx
@@ -925,28 +925,6 @@ describe('CreateTaskInlineEntry', () => {
expect(editorData).toBeUndefined();
});
- it('falls back to appending the answers when the second reading fails', async () => {
- // Same contract as the first reading: an assist, never a gate.
- synthesizeInstructionMock.mockRejectedValue(new Error('offline'));
- analyzeIntentMock.mockResolvedValue({
- ...clearReading,
- clarifications: [{ options: ['lobe-chat'], question: 'Which repo?' }],
- confidence: 'medium',
- });
-
- render(<CreateTaskInlineEntry variant="hero" />);
- fireEvent.keyDown(screen.getByTestId('task-editor'), { key: 'Enter', metaKey: true });
-
- await screen.findByText('taskIntent.reviewStep');
- fireEvent.click(screen.getByText('lobe-chat'));
- fireEvent.click(await screen.findByText('taskIntent.create'));
-
- await waitFor(() => expect(createTaskMock).toHaveBeenCalledTimes(1));
- expect(createTaskMock.mock.calls[0][0].instruction).toContain(
- '## taskIntent.answersHeading\n- Which repo? lobe-chat',
- );
- });
-
it('offers the goal handoff only for a request read as a standing goal', async () => {
analyzeIntentMock.mockResolvedValue({ ...clearReading, kind: 'goal' });
diff --git a/src/features/ChatInput/Dictation/editor.test.ts b/src/features/ChatInput/Dictation/editor.test.ts
index 59d6122908c..4f72c40aeba 100644
--- a/src/features/ChatInput/Dictation/editor.test.ts
+++ b/src/features/ChatInput/Dictation/editor.test.ts
@@ -37,7 +37,6 @@ const readText = (editor: ReturnType<typeof createEditor>) =>
describe('LexicalDictationEditor', () => {
it('inserts at the cursor, replaces only the dictation segment, and preserves the draft suffix', () => {
const { adapter, lexicalEditor } = createFixture();
- const attachmentDraft = [{ id: 'attachment-1', name: 'brief.pdf' }];
const snapshot = adapter.begin(vi.fn());
expect(snapshot).toEqual({ anchor: 6, prefix: 'draft ', suffix: 'tail' });
@@ -48,7 +47,6 @@ describe('LexicalDictationEditor', () => {
adapter.finalize('hello ');
expect(readText(lexicalEditor)).toBe('draft hello tail');
- expect(attachmentDraft).toEqual([{ id: 'attachment-1', name: 'brief.pdf' }]);
lexicalEditor.getEditorState().read(() => {
const selection = $getSelection();
expect($isRangeSelection(selection)).toBe(true);
diff --git a/src/features/ChatInput/hooks/useSelectExecutionTarget.test.ts b/src/features/ChatInput/hooks/useSelectExecutionTarget.test.ts
index eb9a20372c9..0e7acae37f9 100644
--- a/src/features/ChatInput/hooks/useSelectExecutionTarget.test.ts
+++ b/src/features/ChatInput/hooks/useSelectExecutionTarget.test.ts
@@ -200,22 +200,6 @@ describe('useSelectExecutionTarget', () => {
);
});
- it("keeps the failure toast for a user's own pick", async () => {
- testState.isDesktop = true;
- testState.electron.gatewayDeviceInfo = { deviceId: 'this-machine' };
- const { result } = renderHook(() => useSelectExecutionTarget('agent-id'));
-
- await result.current('local');
-
- expect(testState.agent.updateAgentConfigById).toHaveBeenCalledWith(
- 'agent-id',
- {
- agencyConfig: { boundDeviceId: 'this-machine', executionTarget: 'local' },
- },
- { rethrow: true },
- );
- });
-
it('records the sandbox choice alongside a local pick', async () => {
testState.isDesktop = true;
testState.electron.gatewayDeviceInfo = { deviceId: 'this-machine' };
diff --git a/src/features/Connectors/CustomConnectorModal/legacyPluginMigration.test.ts b/src/features/Connectors/CustomConnectorModal/legacyPluginMigration.test.ts
index c925f02a44b..3ef4cd45fd2 100644
--- a/src/features/Connectors/CustomConnectorModal/legacyPluginMigration.test.ts
+++ b/src/features/Connectors/CustomConnectorModal/legacyPluginMigration.test.ts
@@ -58,12 +58,6 @@ describe('buildConnectorPayloadFromLegacy', () => {
expect(r.payload.sourceType).toBe('custom');
expect(r.payload.identifier).toBe('grok-with-tavily');
});
-
- it('preserves identifier (agentConfig.plugins references survive)', () => {
- const r = buildConnectorPayloadFromLegacy(stdioPlugin);
- if (!r.ok) throw new Error('expected ok');
- expect(r.payload.identifier).toBe(stdioPlugin.identifier);
- });
});
describe('Shape #2 — http + auth=none + url (879 prod rows)', () => {
diff --git a/src/features/Conversation/Messages/EditedFilesCard/index.test.ts b/src/features/Conversation/Messages/EditedFilesCard/index.test.ts
index 4ef6b2739a5..8e5e7898d37 100644
--- a/src/features/Conversation/Messages/EditedFilesCard/index.test.ts
+++ b/src/features/Conversation/Messages/EditedFilesCard/index.test.ts
@@ -5,12 +5,7 @@ import { afterEach, describe, expect, it, vi } from 'vitest';
import { useChatStore } from '@/store/chat';
-import EditedFilesCard, {
- AGGREGATE_EDITED_FILE_ICON_SIZE,
- getEditedFileIconName,
- getEditedFilesCardMode,
- SINGLE_EDITED_FILE_ICON_SIZE,
-} from './index';
+import EditedFilesCard, { getEditedFileIconName, getEditedFilesCardMode } from './index';
vi.mock('react-i18next', () => ({
useTranslation: () => ({
@@ -76,18 +71,6 @@ describe('getFilePathDisplayInfo', () => {
});
});
-describe('SINGLE_EDITED_FILE_ICON_SIZE', () => {
- it('matches the height of the two-line title block beside it', () => {
- expect(SINGLE_EDITED_FILE_ICON_SIZE).toBe(40);
- });
-});
-
-describe('AGGREGATE_EDITED_FILE_ICON_SIZE', () => {
- it('matches the single-file card so stacked cards share one icon scale', () => {
- expect(AGGREGATE_EDITED_FILE_ICON_SIZE).toBe(40);
- });
-});
-
describe('SingleEditedFileCard', () => {
it('groups line deltas below the title and exposes the diff action as a secondary control', () => {
render(createElement(EditedFilesCard, { entries: [singleEntry] }));
diff --git a/src/features/Conversation/WorkingSidebar/Review/__tests__/FileItem.test.tsx b/src/features/Conversation/WorkingSidebar/Review/__tests__/FileItem.test.tsx
index 2b3ec4667c1..b3ca8a7e9d7 100644
--- a/src/features/Conversation/WorkingSidebar/Review/__tests__/FileItem.test.tsx
+++ b/src/features/Conversation/WorkingSidebar/Review/__tests__/FileItem.test.tsx
@@ -34,13 +34,6 @@ vi.mock('@/services/git', () => ({
}));
describe('FileItemHeader — reveal in tree', () => {
- it('renders the reveal button', () => {
- render(<FileItemHeader additions={1} deletions={0} filePath="src/foo.ts" status="modified" />);
-
- const btn = screen.getByTestId('reveal-in-tree');
- expect(btn).toBeTruthy();
- });
-
it('calls revealInFilesTab with the file path on click', () => {
render(<FileItemHeader additions={1} deletions={0} filePath="src/foo.ts" status="modified" />);
diff --git a/src/features/Conversation/hooks/useAgentMeta.test.ts b/src/features/Conversation/hooks/useAgentMeta.test.ts
index e5562f77939..7e3fe21406e 100644
--- a/src/features/Conversation/hooks/useAgentMeta.test.ts
+++ b/src/features/Conversation/hooks/useAgentMeta.test.ts
@@ -49,8 +49,6 @@ describe('useAgentMeta', () => {
const { result } = renderHook(() => useAgentMeta());
expect(result.current).toEqual(mockMeta);
- expect(result.current.title).toBe('My Custom Agent');
- expect(result.current.avatar).toBe('agent-avatar.png');
});
it('should preserve custom title for builtin inbox agent when set via onboarding', () => {
diff --git a/src/features/Conversation/store/slices/data/reducer.test.ts b/src/features/Conversation/store/slices/data/reducer.test.ts
index 02b331bb515..10474daee81 100644
--- a/src/features/Conversation/store/slices/data/reducer.test.ts
+++ b/src/features/Conversation/store/slices/data/reducer.test.ts
@@ -753,9 +753,6 @@ describe('messagesReducer', () => {
const newState = messagesReducer(initialState, payload);
expect(newState).toEqual(newMessages);
- expect(newState.find((m) => m.id === 'message1')).toBeUndefined();
- expect(newState.find((m) => m.id === 'message2')).toBeUndefined();
- expect(newState.find((m) => m.id === 'newMsg1')).toBeDefined();
});
});
});
diff --git a/src/features/Electron/system/ZoomHUD/index.test.tsx b/src/features/Electron/system/ZoomHUD/index.test.tsx
index 95a6c09c986..a154479598a 100644
--- a/src/features/Electron/system/ZoomHUD/index.test.tsx
+++ b/src/features/Electron/system/ZoomHUD/index.test.tsx
@@ -45,12 +45,6 @@ describe('ZoomHUD', () => {
expect(screen.queryByText(/%/)).toBeNull();
});
- it('shows formatted percentage when event fires', () => {
- render(<ZoomHUD />);
- emit(1.2, 1);
- expect(screen.getByText('120%')).toBeInTheDocument();
- });
-
it('hides after 1500ms of inactivity', () => {
render(<ZoomHUD />);
emit(1.2, 1);
diff --git a/src/features/EvalCapture/buildCaptureDraft.test.ts b/src/features/EvalCapture/buildCaptureDraft.test.ts
index 9385544be07..3f6861e11ed 100644
--- a/src/features/EvalCapture/buildCaptureDraft.test.ts
+++ b/src/features/EvalCapture/buildCaptureDraft.test.ts
@@ -39,12 +39,6 @@ describe('buildCaptureDraft', () => {
]);
});
- it('drops the system message, which is harness context rather than a turn', () => {
- expect(buildCaptureDraft(conversation, 'm5')!.context.some((c) => c.role === 'system')).toBe(
- false,
- );
- });
-
it('captures the first answer with no context at all', () => {
const draft = buildCaptureDraft(conversation, 'm3')!;
diff --git a/src/features/ModelSwitchPanel/components/ControlsForm/__tests__/createLevelSlider.test.tsx b/src/features/ModelSwitchPanel/components/ControlsForm/__tests__/createLevelSlider.test.tsx
index 85b92cebde1..44ff9af139a 100644
--- a/src/features/ModelSwitchPanel/components/ControlsForm/__tests__/createLevelSlider.test.tsx
+++ b/src/features/ModelSwitchPanel/components/ControlsForm/__tests__/createLevelSlider.test.tsx
@@ -69,21 +69,6 @@ describe('createLevelSliderComponent', () => {
expect(screen.getByText('medium')).toBeInTheDocument();
expect(screen.getByText('high')).toBeInTheDocument();
});
-
- it('should use defaultValue when value is not provided but onChange is', () => {
- const TestSlider = createLevelSliderComponent<TestLevel>({
- configKey: 'reasoningEffort',
- defaultValue: 'medium',
- levels: TEST_LEVELS,
- });
-
- const mockOnChange = vi.fn();
-
- // Should not throw and should render
- expect(() => {
- render(<TestSlider onChange={mockOnChange} />);
- }).not.toThrow();
- });
});
describe('factory configuration', () => {
diff --git a/src/features/PageEditor/PageEditor.test.tsx b/src/features/PageEditor/PageEditor.test.tsx
index 75a2172433b..35cb7901d63 100644
--- a/src/features/PageEditor/PageEditor.test.tsx
+++ b/src/features/PageEditor/PageEditor.test.tsx
@@ -1,6 +1,4 @@
-import { renderHook } from '@testing-library/react';
-import { useEffect } from 'react';
-import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest';
+import { describe, expect, it } from 'vitest';
import { getTitleTextAreaInteractionProps, isTitleSubmitKey } from './TitleSection';
@@ -32,81 +30,3 @@ describe('PageEditor title interaction', () => {
).toBe(false);
});
});
-
-describe('PageEditor beforeunload handler', () => {
- let addEventListenerSpy: ReturnType<typeof vi.spyOn>;
- let removeEventListenerSpy: ReturnType<typeof vi.spyOn>;
-
- beforeEach(() => {
- addEventListenerSpy = vi.spyOn(window, 'addEventListener');
- removeEventListenerSpy = vi.spyOn(window, 'removeEventListener');
- });
-
- afterEach(() => {
- vi.restoreAllMocks();
- });
-
- it('should call preventDefault when isDirty is true', () => {
- const preventDefaultMock = vi.fn();
- const handleBeforeUnload = vi.fn((e: BeforeUnloadEvent) => {
- const isDirty = true;
- if (isDirty) {
- e.preventDefault();
- preventDefaultMock();
- }
- });
-
- window.addEventListener('beforeunload', handleBeforeUnload);
-
- const event = new Event('beforeunload') as BeforeUnloadEvent;
- window.dispatchEvent(event);
-
- expect(handleBeforeUnload).toHaveBeenCalled();
- expect(preventDefaultMock).toHaveBeenCalled();
-
- window.removeEventListener('beforeunload', handleBeforeUnload);
- });
-
- it('should not call preventDefault when isDirty is false', () => {
- const preventDefaultMock = vi.fn();
- const handleBeforeUnload = vi.fn((e: BeforeUnloadEvent) => {
- const isDirty = false;
- if (isDirty) {
- e.preventDefault();
- preventDefaultMock();
- }
- });
-
- window.addEventListener('beforeunload', handleBeforeUnload);
-
- const event = new Event('beforeunload') as BeforeUnloadEvent;
- window.dispatchEvent(event);
-
- expect(handleBeforeUnload).toHaveBeenCalled();
- expect(preventDefaultMock).not.toHaveBeenCalled();
-
- window.removeEventListener('beforeunload', handleBeforeUnload);
- });
-
- it('should add and remove event listener through useEffect', () => {
- const { unmount } = renderHook(() =>
- useEffect(() => {
- const handleBeforeUnload = (e: BeforeUnloadEvent) => {
- e.preventDefault();
- };
-
- window.addEventListener('beforeunload', handleBeforeUnload);
-
- return () => {
- window.removeEventListener('beforeunload', handleBeforeUnload);
- };
- }, []),
- );
-
- expect(addEventListenerSpy).toHaveBeenCalledWith('beforeunload', expect.any(Function));
-
- unmount();
-
- expect(removeEventListenerSpy).toHaveBeenCalledWith('beforeunload', expect.any(Function));
- });
-});
diff --git a/src/features/ProfileEditor/staleProfilePlugins.test.ts b/src/features/ProfileEditor/staleProfilePlugins.test.ts
index 08cc39acc15..a65cd1c2b71 100644
--- a/src/features/ProfileEditor/staleProfilePlugins.test.ts
+++ b/src/features/ProfileEditor/staleProfilePlugins.test.ts
@@ -103,15 +103,6 @@ describe('resolveStalePluginCleanup', () => {
).toEqual(['web-search', 'market-skill', { identifier: 'kept-disabled', mode: 'disabled' }]);
});
- it('does not remove a now-resolved entry even if the server called it not-a-skill', () => {
- expect(
- resolveStalePluginCleanup(
- baseInput({ plugins: ['web-search'], validIdentifiers: new Set(['web-search']) }),
- notSkill('web-search'),
- ),
- ).toBeNull();
- });
-
it('returns null before the connector store has loaded', () => {
expect(
resolveStalePluginCleanup(baseInput({ isConnectorsInit: false }), notSkill('ghost-tool')),
diff --git a/src/features/Settings/hooks/useCategory.test.tsx b/src/features/Settings/hooks/useCategory.test.tsx
index df2bf64b4ed..84c3732680e 100644
--- a/src/features/Settings/hooks/useCategory.test.tsx
+++ b/src/features/Settings/hooks/useCategory.test.tsx
@@ -117,12 +117,6 @@ describe('settings useCategory', () => {
expect(getItemKeys()).not.toContain(SettingsTabs.OAuthApps);
});
- it('shows Integrations in the Account group without any Labs flag', () => {
- const { result } = renderHook(() => useCategory(), { wrapper: createWrapper(true) });
- const accountGroup = result.current.find((group) => group.key === SettingsGroupKey.Account);
- expect(accountGroup?.items.map((item) => item.key)).toContain(SettingsTabs.Integrations);
- });
-
// The sandbox drives moved to Docs → Sandbox Storage; settings keep only the
// environment definitions.
it('keeps Environments in settings without a sandbox storage tab', () => {
diff --git a/src/features/Settings/oauth-apps/useLogoUpload.test.ts b/src/features/Settings/oauth-apps/useLogoUpload.test.ts
index b409dd51010..ab05444326b 100644
--- a/src/features/Settings/oauth-apps/useLogoUpload.test.ts
+++ b/src/features/Settings/oauth-apps/useLogoUpload.test.ts
@@ -34,7 +34,6 @@ describe('useLogoUpload', () => {
});
expect(url).toBe('https://files.lobehub.com/logo.png');
- expect(url?.startsWith('data:')).toBe(false);
});
it('turns a storage path into an absolute URL the provider accepts', async () => {
diff --git a/src/features/Settings/provider/features/ModelList/CreateNewModelModal/__tests__/ExtendParamsSelect.test.tsx b/src/features/Settings/provider/features/ModelList/CreateNewModelModal/__tests__/ExtendParamsSelect.test.tsx
index f802e7e6ed0..545ec7ae4a1 100644
--- a/src/features/Settings/provider/features/ModelList/CreateNewModelModal/__tests__/ExtendParamsSelect.test.tsx
+++ b/src/features/Settings/provider/features/ModelList/CreateNewModelModal/__tests__/ExtendParamsSelect.test.tsx
@@ -2,9 +2,6 @@ import { describe, expect, it } from 'vitest';
import { normalizeExtendParamsValue } from '../ExtendParamsSelect';
-// Import the constant directly for testing
-// We'll need to test the TITLE_KEY_ALIASES logic
-
describe('ExtendParamsSelect', () => {
describe('normalizeExtendParamsValue', () => {
const definitionMap = new Map([
@@ -27,81 +24,4 @@ describe('ExtendParamsSelect', () => {
).toEqual(['enableReasoning', 'reasoningMode', 'reasoningBudgetToken']);
});
});
-
- describe('TITLE_KEY_ALIASES mapping', () => {
- // This mapping should be synced with ControlsForm.tsx
- const TITLE_KEY_ALIASES: Record<string, string> = {
- gpt5ReasoningEffort: 'reasoningEffort',
- gpt5_1ReasoningEffort: 'reasoningEffort',
- gpt5_2ProReasoningEffort: 'reasoningEffort',
- gpt5_2ReasoningEffort: 'reasoningEffort',
- gpt5_6ReasoningEffort: 'reasoningEffort',
- glm5_2ReasoningEffort: 'reasoningEffort',
- glm5_3ReasoningEffort: 'reasoningEffort',
- qwen38ReasoningEffort: 'reasoningEffort',
- thinkingLevel2: 'thinkingLevel',
- };
-
- it('should map GPT5 variants to reasoningEffort', () => {
- expect(TITLE_KEY_ALIASES['gpt5ReasoningEffort']).toBe('reasoningEffort');
- expect(TITLE_KEY_ALIASES['gpt5_1ReasoningEffort']).toBe('reasoningEffort');
- expect(TITLE_KEY_ALIASES['gpt5_2ReasoningEffort']).toBe('reasoningEffort');
- expect(TITLE_KEY_ALIASES['gpt5_2ProReasoningEffort']).toBe('reasoningEffort');
- expect(TITLE_KEY_ALIASES['gpt5_6ReasoningEffort']).toBe('reasoningEffort');
- });
-
- it('should map GLM-5.2 variant to reasoningEffort', () => {
- expect(TITLE_KEY_ALIASES['glm5_2ReasoningEffort']).toBe('reasoningEffort');
- });
-
- it('should map GLM-5.3 variant to reasoningEffort', () => {
- expect(TITLE_KEY_ALIASES['glm5_3ReasoningEffort']).toBe('reasoningEffort');
- });
-
- it('should map Qwen3.8 Max variant to reasoningEffort', () => {
- expect(TITLE_KEY_ALIASES['qwen38ReasoningEffort']).toBe('reasoningEffort');
- });
-
- it('should map thinkingLevel2 to thinkingLevel', () => {
- expect(TITLE_KEY_ALIASES['thinkingLevel2']).toBe('thinkingLevel');
- });
-
- it('should return undefined for keys without aliases', () => {
- expect(TITLE_KEY_ALIASES['reasoningEffort']).toBeUndefined();
- expect(TITLE_KEY_ALIASES['thinkingLevel']).toBeUndefined();
- expect(TITLE_KEY_ALIASES['thinking']).toBeUndefined();
- });
- });
-
- describe('title key resolution logic', () => {
- const TITLE_KEY_ALIASES: Record<string, string> = {
- gpt5ReasoningEffort: 'reasoningEffort',
- gpt5_1ReasoningEffort: 'reasoningEffort',
- gpt5_2ProReasoningEffort: 'reasoningEffort',
- gpt5_2ReasoningEffort: 'reasoningEffort',
- gpt5_6ReasoningEffort: 'reasoningEffort',
- glm5_2ReasoningEffort: 'reasoningEffort',
- glm5_3ReasoningEffort: 'reasoningEffort',
- qwen38ReasoningEffort: 'reasoningEffort',
- thinkingLevel2: 'thinkingLevel',
- };
-
- const getTitleKey = (key: string): string => {
- return TITLE_KEY_ALIASES[key] ?? key;
- };
-
- it('should return the alias key when available', () => {
- expect(getTitleKey('gpt5ReasoningEffort')).toBe('reasoningEffort');
- expect(getTitleKey('glm5_2ReasoningEffort')).toBe('reasoningEffort');
- expect(getTitleKey('glm5_3ReasoningEffort')).toBe('reasoningEffort');
- expect(getTitleKey('qwen38ReasoningEffort')).toBe('reasoningEffort');
- expect(getTitleKey('thinkingLevel2')).toBe('thinkingLevel');
- });
-
- it('should return the original key when no alias exists', () => {
- expect(getTitleKey('reasoningEffort')).toBe('reasoningEffort');
- expect(getTitleKey('thinking')).toBe('thinking');
- expect(getTitleKey('textVerbosity')).toBe('textVerbosity');
- });
- });
});
diff --git a/src/features/User/__tests__/PanelContent.test.tsx b/src/features/User/__tests__/PanelContent.test.tsx
index 1284d3bf8b3..b1256e56145 100644
--- a/src/features/User/__tests__/PanelContent.test.tsx
+++ b/src/features/User/__tests__/PanelContent.test.tsx
@@ -115,16 +115,6 @@ describe('PanelContent', () => {
expect(screen.getAllByText('Mocked Menu')).toHaveLength(1);
expect(screen.getByText('Logout')).toBeInTheDocument();
});
-
- it('should render SignInBlock when user is not signed in', () => {
- act(() => {
- useUserStore.setState({ isSignedIn: false });
- });
-
- renderWithRouter(<PanelContent closePopover={closePopover} />);
-
- expect(screen.getByText('Mocked SignInBlock')).toBeInTheDocument();
- });
});
it('should render Menu with main items', () => {
diff --git a/src/hooks/useHotkeys/useHotkeyById.test.ts b/src/hooks/useHotkeys/useHotkeyById.test.ts
index f581c46ee3d..cd603a84167 100644
--- a/src/hooks/useHotkeys/useHotkeyById.test.ts
+++ b/src/hooks/useHotkeys/useHotkeyById.test.ts
@@ -1,6 +1,5 @@
import { HotkeyEnum, HOTKEYS_REGISTRATION, HotkeyScopeEnum } from '@lobechat/const/hotkeys';
import { renderHook } from '@testing-library/react';
-import { uniq } from 'es-toolkit/compat';
import { beforeEach, describe, expect, it, vi } from 'vitest';
import { useHotkeyById } from './useHotkeyById';
@@ -118,8 +117,6 @@ describe('useHotkeyById', () => {
}),
undefined,
);
-
- expect(uniq).toHaveBeenCalled();
});
it('should handle dependencies parameter correctly', () => {
diff --git a/src/hooks/useIsSingleMode.test.ts b/src/hooks/useIsSingleMode.test.ts
index 16e38003378..f179df4aa58 100644
--- a/src/hooks/useIsSingleMode.test.ts
+++ b/src/hooks/useIsSingleMode.test.ts
@@ -10,16 +10,6 @@ vi.mock('@/libs/router/navigation', () => ({
}));
describe('useIsSingleMode', () => {
- it('should return false initially (during SSR)', () => {
- const mockSearchParams = new URLSearchParams('mode=single');
- mockUseSearchParams.mockReturnValue([mockSearchParams, vi.fn()]);
-
- const { result } = renderHook(() => useIsSingleMode());
-
- // In test environment, useEffect runs synchronously, so it will immediately detect single mode
- expect(result.current).toBe(true);
- });
-
it('should return true when mode=single', () => {
const mockSearchParams = new URLSearchParams('mode=single');
mockUseSearchParams.mockReturnValue([mockSearchParams, vi.fn()]);
@@ -49,4 +39,4 @@ describe('useIsSingleMode', () => {
// Should return false when no mode parameter
expect(result.current).toBe(false);
});
-});
\ No newline at end of file
+});
diff --git a/src/libs/getUILocaleAndResources.test.ts b/src/libs/getUILocaleAndResources.test.ts
index b433defceb2..36ae83a81c6 100644
--- a/src/libs/getUILocaleAndResources.test.ts
+++ b/src/libs/getUILocaleAndResources.test.ts
@@ -14,12 +14,6 @@ describe('getUILocaleAndResources', () => {
expect(result.resources).toBeDefined();
});
- it('should normalize business ui.json into a @lobehub/ui consumable resource map', async () => {
- const result = await getUILocaleAndResources('zh-CN');
-
- expect(translateFromUILocaleResources(result.resources, 'form.submit')).toBe('提交');
- });
-
it('should merge built-in resources with partial business ui.json resources', async () => {
const result = await getUILocaleAndResources('zh-CN');
@@ -76,12 +70,6 @@ describe('getUILocaleAndResources', () => {
expect(result.resources).toBeDefined();
});
- it('should return de-DE locale and custom resources for de-DE', async () => {
- const result = await getUILocaleAndResources('de-DE');
- expect(result.locale).toBe('de-DE');
- expect(result.resources).toBeDefined();
- });
-
it('should return es-ES locale and custom resources for es-ES', async () => {
const result = await getUILocaleAndResources('es-ES');
expect(result.locale).toBe('es-ES');
diff --git a/src/libs/oidc-provider/provider.test.ts b/src/libs/oidc-provider/provider.test.ts
index 63f04c4237c..5c4f9deee49 100644
--- a/src/libs/oidc-provider/provider.test.ts
+++ b/src/libs/oidc-provider/provider.test.ts
@@ -34,10 +34,6 @@ describe('OIDC Provider - Market Client Integration', () => {
});
describe('Market Client Logic', () => {
- it('should identify market client correctly', () => {
- expect(MARKET_CLIENT_ID).toBe('lobehub-market');
- });
-
it('should have market client in default clients', async () => {
vi.doMock('@/envs/app', () => ({
appEnv: {
@@ -208,128 +204,4 @@ describe('OIDC Provider - Market Client Integration', () => {
vi.doUnmock('@/envs/app');
}, 10000);
});
-
- describe('Name Resolution Priority', () => {
- it('should prioritize fullName over firstName+lastName', () => {
- const priorities = ['fullName', 'firstName + lastName', 'username', 'id'];
-
- // Test the priority logic
- expect(priorities[0]).toBe('fullName');
- expect(priorities[1]).toBe('firstName + lastName');
- expect(priorities[2]).toBe('username');
- expect(priorities[3]).toBe('id');
- });
- });
-
- describe('Claims Generation', () => {
- it('should include profile claims when profile scope is requested', () => {
- const scopes = ['openid', 'profile', 'email'];
- expect(scopes).toContain('profile');
- });
-
- it('should include email claims when email scope is requested', () => {
- const scopes = ['openid', 'profile', 'email'];
- expect(scopes).toContain('email');
- });
-
- it('should always include sub claim', () => {
- const requiredClaims = ['sub'];
- expect(requiredClaims).toContain('sub');
- });
- });
-
- describe('Non-Market Client Logic (Default Path)', () => {
- it('should use UserModel for non-market clients (desktop client)', () => {
- // Desktop client should use the default user database lookup
- const desktopClientId = 'lobehub-desktop';
- expect(desktopClientId).not.toBe(MARKET_CLIENT_ID);
- });
-
- it('should use UserModel for non-market clients (mobile client)', () => {
- // Mobile client should use the default user database lookup
- const mobileClientId = 'lobehub-mobile';
- expect(mobileClientId).not.toBe(MARKET_CLIENT_ID);
- });
-
- it('should validate non-market client IDs are different from market client', () => {
- const nonMarketClients = ['lobehub-desktop', 'lobehub-mobile'];
-
- nonMarketClients.forEach((clientId) => {
- expect(clientId).not.toBe(MARKET_CLIENT_ID);
- });
- });
- });
-
- describe('Account ID Priority Logic', () => {
- it('should prioritize externalAccountId over session accountId', () => {
- const priorities = {
- first: 'externalAccountId',
- second: 'ctx.oidc.session.accountId',
- third: 'parameter id',
- };
-
- expect(priorities.first).toBe('externalAccountId');
- expect(priorities.second).toBe('ctx.oidc.session.accountId');
- expect(priorities.third).toBe('parameter id');
- });
-
- it('should document account ID resolution priority', () => {
- // Priority: 1. externalAccountId 2. ctx.oidc.session?.accountId 3. id parameter
- const accountIdPriority = [
- 'externalAccountId (highest)',
- 'ctx.oidc.session.accountId (medium)',
- 'id parameter (lowest)',
- ];
-
- expect(accountIdPriority).toHaveLength(3);
- expect(accountIdPriority[0]).toContain('externalAccountId');
- expect(accountIdPriority[1]).toContain('ctx.oidc.session.accountId');
- expect(accountIdPriority[2]).toContain('id parameter');
- });
- });
-
- describe('Business Logic Scenarios', () => {
- describe('Scenario 1: Desktop Client + Local Database', () => {
- it('should use local UserModel for desktop client', () => {
- // Business: Desktop app uses local database for user management
- const scenario = {
- client: 'lobehub-desktop',
- authProvider: 'UserModel (Local Database)',
- useCase: 'Desktop app with local/self-hosted user database',
- };
-
- expect(scenario.client).toBe('lobehub-desktop');
- expect(scenario.authProvider).toBe('UserModel (Local Database)');
- });
- });
-
- describe('Scenario 2: Mobile Client + Local Database', () => {
- it('should use local UserModel for mobile client', () => {
- // Business: Mobile app uses local database for user management
- const scenario = {
- client: 'lobehub-mobile',
- authProvider: 'UserModel (Local Database)',
- useCase: 'Mobile app with local/self-hosted user database',
- };
-
- expect(scenario.client).toBe('lobehub-mobile');
- expect(scenario.authProvider).toBe('UserModel (Local Database)');
- });
- });
-
- describe('Scenario 3: Claims Generation', () => {
- it('should generate database-based claims for clients', () => {
- // Business: Users get profile/email from local DB
- const localClaims = {
- source: 'UserModel (PostgreSQL/PGLite)',
- fields: ['sub', 'name', 'picture', 'email', 'email_verified'],
- nameResolution: 'fullName || username || firstName+lastName',
- };
-
- expect(localClaims.source).toBe('UserModel (PostgreSQL/PGLite)');
- expect(localClaims.fields).toContain('name');
- expect(localClaims.fields).toContain('email');
- });
- });
- });
});
diff --git a/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/utils.test.ts b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/utils.test.ts
index bcf1783e5bd..4e5c9c18132 100644
--- a/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/utils.test.ts
+++ b/src/routes/(main)/(create)/image/features/GenerationFeed/GenerationItem/utils.test.ts
@@ -487,15 +487,6 @@ describe('getThumbnailMaxWidth (isolated unit testing)', () => {
expect(result).toBe(DEFAULT_MAX_ITEM_WIDTH * 2);
});
- it('should return DEFAULT_MAX_ITEM_WIDTH when height is missing', () => {
- const mockGen: Generation = {
- ...mockGeneration,
- // No asset with valid dimensions
- };
- const result = getThumbnailMaxWidth(mockGen);
- expect(result).toBe(DEFAULT_MAX_ITEM_WIDTH * 2);
- });
-
it('should calculate width based on screen height constraint', () => {
const mockGen: Generation = {
...mockGeneration,
diff --git a/src/routes/(main)/agent/(chat)/topicListLoader.test.ts b/src/routes/(main)/agent/(chat)/topicListLoader.test.ts
index 05a123e8a04..7b77003f9a2 100644
--- a/src/routes/(main)/agent/(chat)/topicListLoader.test.ts
+++ b/src/routes/(main)/agent/(chat)/topicListLoader.test.ts
@@ -92,14 +92,6 @@ describe('agent chat topic list loader', () => {
getSidebarTopicListParamsMock.mockReturnValue({ agentId: 'agt_1', pageSize: 20 });
});
- /** @example The per-agent "only mine" filter is restored synchronously, so nothing gates the seed. */
- it('seeds the topic page from the derived sidebar params', async () => {
- await agentChatTopicListLoader(loaderArgs('agt_1'));
-
- expect(getSidebarTopicListParamsMock).toHaveBeenCalledWith({ agentId: 'agt_1' });
- expect(preHydrateTopicListMock).toHaveBeenCalledWith({ agentId: 'agt_1', pageSize: 20 });
- });
-
it('seeds the persisted device list before the route commits', async () => {
await agentChatTopicListLoader(loaderArgs('agt_1'));
diff --git a/src/services/chat/mecha/agentConfigResolver.test.ts b/src/services/chat/mecha/agentConfigResolver.test.ts
index 562284431da..91a671193ca 100644
--- a/src/services/chat/mecha/agentConfigResolver.test.ts
+++ b/src/services/chat/mecha/agentConfigResolver.test.ts
@@ -364,34 +364,6 @@ describe('resolveAgentConfig', () => {
expect(result.agentConfig.params.reasoning_effort).toBe('high');
});
- it('should include reasoning_effort when enableReasoningEffort is true', () => {
- vi.spyOn(agentSelectors.chatConfigByIdSelectors, 'getChatConfigById').mockReturnValue(
- () =>
- ({
- enableMaxTokens: false,
- enableReasoningEffort: true,
- }) as any,
- );
-
- const result = resolveAgentConfig({ agentId: 'test-agent' });
-
- expect(result.agentConfig.params.reasoning_effort).toBe('high');
- });
-
- it('should set reasoning_effort to undefined when enableReasoningEffort is false', () => {
- vi.spyOn(agentSelectors.chatConfigByIdSelectors, 'getChatConfigById').mockReturnValue(
- () =>
- ({
- enableMaxTokens: true,
- enableReasoningEffort: false,
- }) as any,
- );
-
- const result = resolveAgentConfig({ agentId: 'test-agent' });
-
- expect(result.agentConfig.params.reasoning_effort).toBeUndefined();
- });
-
it('should handle both params being enabled', () => {
vi.spyOn(agentSelectors.chatConfigByIdSelectors, 'getChatConfigById').mockReturnValue(
() =>
diff --git a/src/store/agentDocument/replica.test.ts b/src/store/agentDocument/replica.test.ts
index 25256f254b2..05453ac3b30 100644
--- a/src/store/agentDocument/replica.test.ts
+++ b/src/store/agentDocument/replica.test.ts
@@ -106,10 +106,6 @@ describe('agent document replicas', () => {
const renderSync = () =>
renderHook(() => agentDocumentActions.useFetchDocumentList(AGENT_ID), { wrapper });
- it('caps how many agents keep a persisted list', () => {
- expect(agentDocumentListResource.maxPersistedEntries).toBe(30);
- });
-
it('paints the persisted list before the network answers', async () => {
await agentDocumentListResource.storage!.set(
{ queryKey: LIST_KEY, scope },
@@ -257,10 +253,6 @@ describe('agent document replicas', () => {
const renderSync = () =>
renderHook(() => agentDocumentActions.useFetchReaderDocument(READER), { wrapper });
- it('caps how many reader bodies persist', () => {
- expect(agentDocumentReaderResource.maxPersistedEntries).toBe(20);
- });
-
it('paints the persisted body before the network answers', async () => {
await agentDocumentReaderResource.storage!.set(
{ queryKey: READER_KEY, scope },
diff --git a/src/store/chat/agents/GroupOrchestration/__tests__/batch-exec-async-tasks.test.ts b/src/store/chat/agents/GroupOrchestration/__tests__/batch-exec-async-tasks.test.ts
index cfb7dd782d6..64c9dadcefa 100644
--- a/src/store/chat/agents/GroupOrchestration/__tests__/batch-exec-async-tasks.test.ts
+++ b/src/store/chat/agents/GroupOrchestration/__tests__/batch-exec-async-tasks.test.ts
@@ -235,72 +235,6 @@ describe('createGroupOrchestrationExecutors', () => {
);
});
- it('should call execSubAgentTask for each task', async () => {
- const mockStore = createMockStore();
-
- vi.mocked(aiAgentService.execSubAgentTask).mockResolvedValue(
- createMockExecResult({ threadId: 'thread-1' }),
- );
-
- vi.mocked(aiAgentService.getSubAgentTaskStatus).mockResolvedValue({
- result: 'Task completed',
- status: 'completed',
- });
-
- const executors = createGroupOrchestrationExecutors({
- get: () => mockStore,
- messageContext: {
- agentId: TEST_IDS.GROUP_ID,
- groupId: TEST_IDS.GROUP_ID,
- scope: 'group',
- topicId: TEST_IDS.TOPIC_ID,
- },
- orchestrationOperationId: TEST_IDS.ORCHESTRATION_OPERATION_ID,
- supervisorAgentId: TEST_IDS.SUPERVISOR_AGENT_ID,
- });
-
- const batchExecTasksExecutor = executors.batch_exec_async_tasks!;
-
- await batchExecTasksExecutor(
- {
- payload: {
- tasks: [
- { agentId: TEST_IDS.AGENT_1_ID, instruction: 'Task 1', title: 'Task 1 Title' },
- { agentId: TEST_IDS.AGENT_2_ID, instruction: 'Task 2', title: 'Task 2 Title' },
- ],
- toolMessageId: TEST_IDS.TOOL_MESSAGE_ID,
- },
- type: 'batch_exec_async_tasks',
- },
- createInitialState(),
- );
-
- // Should call execSubAgentTask for both tasks
- expect(aiAgentService.execSubAgentTask).toHaveBeenCalledTimes(2);
-
- expect(aiAgentService.execSubAgentTask).toHaveBeenCalledWith(
- expect.objectContaining({
- agentId: TEST_IDS.AGENT_1_ID,
- groupId: TEST_IDS.GROUP_ID,
- instruction: 'Task 1',
- parentMessageId: TEST_IDS.TOOL_MESSAGE_ID,
- title: 'Task 1 Title',
- topicId: TEST_IDS.TOPIC_ID,
- }),
- );
-
- expect(aiAgentService.execSubAgentTask).toHaveBeenCalledWith(
- expect.objectContaining({
- agentId: TEST_IDS.AGENT_2_ID,
- groupId: TEST_IDS.GROUP_ID,
- instruction: 'Task 2',
- parentMessageId: TEST_IDS.TOOL_MESSAGE_ID,
- title: 'Task 2 Title',
- topicId: TEST_IDS.TOPIC_ID,
- }),
- );
- });
-
it('should return tasks_completed result with all task results', async () => {
const mockStore = createMockStore();
diff --git a/src/store/chat/agents/__tests__/clientRuntimeExecutors/finish.test.ts b/src/store/chat/agents/__tests__/clientRuntimeExecutors/finish.test.ts
index 150e8ecdd66..b9869da8537 100644
--- a/src/store/chat/agents/__tests__/clientRuntimeExecutors/finish.test.ts
+++ b/src/store/chat/agents/__tests__/clientRuntimeExecutors/finish.test.ts
@@ -426,7 +426,6 @@ describe('finish executor', () => {
// Then
const doneEvent = result.events[0] as AgentEventDone;
expect(doneEvent.reasonDetail).toBe(longDetail);
- expect(doneEvent.reasonDetail?.length).toBe(10000);
});
it('should handle state with empty messages array', async () => {
diff --git a/src/store/chat/agents/__tests__/clientRuntimeExecutors/resolve-aborted-tools.test.ts b/src/store/chat/agents/__tests__/clientRuntimeExecutors/resolve-aborted-tools.test.ts
index ca4ce91ee8c..a4d3e1607e0 100644
--- a/src/store/chat/agents/__tests__/clientRuntimeExecutors/resolve-aborted-tools.test.ts
+++ b/src/store/chat/agents/__tests__/clientRuntimeExecutors/resolve-aborted-tools.test.ts
@@ -393,27 +393,6 @@ describe('resolve_aborted_tools executor', () => {
});
describe('Event Handling', () => {
- it('should emit single done event', async () => {
- // Given
- const mockStore = createMockStore();
- const context = createTestContext();
- const instruction = createResolveAbortedToolsInstruction();
- const state = createInitialState();
-
- // When
- const result = await executeWithMockContext({
- executor: 'resolve_aborted_tools',
- instruction,
- state,
- mockStore,
- context,
- });
-
- // Then
- expect(result.events).toHaveLength(1);
- expect(result.events[0].type).toBe('done');
- });
-
it('should include finalState in event', async () => {
// Given
const mockStore = createMockStore();
diff --git a/src/store/chat/slices/message/reducer.test.ts b/src/store/chat/slices/message/reducer.test.ts
index 080d08b85c5..54ef642dc03 100644
--- a/src/store/chat/slices/message/reducer.test.ts
+++ b/src/store/chat/slices/message/reducer.test.ts
@@ -627,15 +627,5 @@ describe('messagesReducer', () => {
expect(newState.find((m) => m.id === 'message1')).toBeUndefined();
expect(newState.find((m) => m.id === 'message2')).toBeUndefined();
});
-
- it('should not modify state if message to delete is not found', () => {
- const payload: MessageDispatch = {
- type: 'deleteMessage',
- id: 'nonexistentMessage',
- };
-
- const newState = messagesReducer(initialState, payload);
- expect(newState).toEqual(initialState);
- });
});
});
diff --git a/src/store/chat/slices/topic/selectors.test.ts b/src/store/chat/slices/topic/selectors.test.ts
index 708c455a602..5025c2117de 100644
--- a/src/store/chat/slices/topic/selectors.test.ts
+++ b/src/store/chat/slices/topic/selectors.test.ts
@@ -543,9 +543,6 @@ describe('topicSelectors', () => {
// Should not have a favorites group
expect(grouped.find((g) => g.id === 'favorite')).toBeUndefined();
-
- // Should have time-based groups
- expect(grouped.every((g) => g.id !== 'favorite')).toBeTruthy();
});
});
diff --git a/src/store/chat/utils/messageMapKey.test.ts b/src/store/chat/utils/messageMapKey.test.ts
index 6e42cd3518f..adafc534912 100644
--- a/src/store/chat/utils/messageMapKey.test.ts
+++ b/src/store/chat/utils/messageMapKey.test.ts
@@ -39,16 +39,6 @@ describe('messageMapKey', () => {
});
expect(result).toBe('thread_agt_xxx_tpc_yyy_new');
});
-
- it('should handle explicit thread scope with isNew', () => {
- const result = messageMapKey({
- scope: 'thread',
- agentId: 'agt_xxx',
- topicId: 'tpc_yyy',
- isNew: true,
- });
- expect(result).toBe('thread_agt_xxx_tpc_yyy_new');
- });
});
describe('Group mode', () => {
@@ -125,17 +115,6 @@ describe('messageMapKey', () => {
expect(result).toBe('group_grp_yyy_tpc_zzz');
});
- it('should prioritize groupId over agentId for scope detection', () => {
- const result = messageMapKey({
- agentId: 'agt_xxx',
- groupId: 'grp_yyy',
- topicId: 'tpc_zzz',
- });
- // groupId takes priority, agentId is ignored
- expect(result).toContain('grp_yyy');
- expect(result).not.toContain('agt_xxx');
- });
-
it('should handle groupId with isNew flag', () => {
const result = messageMapKey({
agentId: 'agt_xxx',
@@ -353,16 +332,6 @@ describe('messageMapKey', () => {
});
describe('isNew flag behavior', () => {
- it('should add _new suffix when isNew is true and topicId exists', () => {
- const result = messageMapKey({
- scope: 'thread',
- agentId: 'agt_xxx',
- topicId: 'tpc_yyy',
- isNew: true,
- });
- expect(result).toBe('thread_agt_xxx_tpc_yyy_new');
- });
-
it('should not add extra _new when isNew is true but no topicId (already _new)', () => {
const result = messageMapKey({
scope: 'main',
diff --git a/src/store/eval/slices/dataset/action.test.ts b/src/store/eval/slices/dataset/action.test.ts
index 971ad4caf9c..82fc2d40705 100644
--- a/src/store/eval/slices/dataset/action.test.ts
+++ b/src/store/eval/slices/dataset/action.test.ts
@@ -190,12 +190,4 @@ describe('DatasetAction replica wiring', () => {
).toBe(true);
});
});
-
- it('no longer exposes the retired reducer internals', () => {
- const state = useEvalStore.getState() as Record<string, unknown>;
- expect(state.internal_dispatchDatasetDetail).toBeUndefined();
- expect(state.internal_updateDatasetDetailLoading).toBeUndefined();
- expect(state.isLoadingDatasets).toBeUndefined();
- expect(state.loadingDatasetDetailIds).toBeUndefined();
- });
});
diff --git a/src/store/file/slices/fileManager/action.test.ts b/src/store/file/slices/fileManager/action.test.ts
index 21ac7976b04..378151bc90e 100644
--- a/src/store/file/slices/fileManager/action.test.ts
+++ b/src/store/file/slices/fileManager/action.test.ts
@@ -176,19 +176,6 @@ describe('FileManagerActions', () => {
expect(result.current.dockUploadFileList[0].id).toBe('file-1');
});
- it('should not update state if reducer returns same value', () => {
- const { result } = renderHook(() => useStore());
-
- const initialList = result.current.dockUploadFileList;
-
- // This tests the early return when value hasn't changed
- act(() => {
- useStore.setState({ dockUploadFileList: initialList });
- });
-
- expect(result.current.dockUploadFileList).toBe(initialList);
- });
-
it('should handle updateFileStatus dispatch', () => {
const { result } = renderHook(() => useStore());
diff --git a/src/store/goal/goalListFilter.test.ts b/src/store/goal/goalListFilter.test.ts
index 8514d93c483..afd5cb7e429 100644
--- a/src/store/goal/goalListFilter.test.ts
+++ b/src/store/goal/goalListFilter.test.ts
@@ -14,19 +14,6 @@ describe('goalStatusesForFilter', () => {
expect(goalStatusesForFilter('achieved')).toEqual(['achieved']);
});
- it('never widens a narrow tab into the states it must not show', () => {
- for (const filter of ['review', 'running'] as const) {
- expect(goalStatusesForFilter(filter)).not.toContain('achieved');
- expect(goalStatusesForFilter(filter)).not.toContain('canceled');
- }
-
- // `achieved` is a terminal tab, but "completed" does not name a failure or
- // a cancellation: those stay reachable through `all` only.
- expect(goalStatusesForFilter('achieved')).not.toContain('canceled');
- expect(goalStatusesForFilter('achieved')).not.toContain('failed');
- expect(goalStatusesForFilter('achieved')).not.toContain('running');
- });
-
it('returns a fresh array for All, so a caller cannot mutate the shared status list', () => {
const first = goalStatusesForFilter('all');
first.push('achieved');
diff --git a/src/store/serverConfig/action.test.ts b/src/store/serverConfig/action.test.ts
index 9ea46958980..27da44f598f 100644
--- a/src/store/serverConfig/action.test.ts
+++ b/src/store/serverConfig/action.test.ts
@@ -97,20 +97,6 @@ describe('ServerConfigAction', () => {
expect(store.getState().serverConfig).toEqual({ aiProvider: {}, telemetry: {} });
expect(store.getState().canAccessDevDock).toBe(false);
});
-
- it('should pass a fetcher function that calls globalService', async () => {
- const { useOnlyFetchOnceSWR } = vi.mocked(await import('@/libs/swr'));
-
- const store = initServerConfigStore({});
-
- store.getState().useInitServerConfig();
-
- expect(useOnlyFetchOnceSWR).toHaveBeenCalled();
-
- // Verify the second argument is a function
- const fetcherArg = (useOnlyFetchOnceSWR as any).mock.calls[0][1];
- expect(typeof fetcherArg).toBe('function');
- });
});
describe('onSuccess callback', () => {
diff --git a/src/store/tool/slices/lobehubSkillStore/selectors.test.ts b/src/store/tool/slices/lobehubSkillStore/selectors.test.ts
index a718428da8c..873daa2eade 100644
--- a/src/store/tool/slices/lobehubSkillStore/selectors.test.ts
+++ b/src/store/tool/slices/lobehubSkillStore/selectors.test.ts
@@ -33,12 +33,6 @@ describe('lobehubSkillStoreSelectors', () => {
const result = lobehubSkillStoreSelectors.getServers(state);
expect(result).toEqual(servers);
});
-
- it('should handle undefined lobehubSkillServers', () => {
- const state = { ...initialState, lobehubSkillServers: undefined } as unknown as ToolStore;
- const result = lobehubSkillStoreSelectors.getServers(state);
- expect(result).toEqual([]);
- });
});
describe('getConnectedServers', () => {
diff --git a/src/utils/rbac.test.ts b/src/utils/rbac.test.ts
index 27792467a5e..d1be26b2611 100644
--- a/src/utils/rbac.test.ts
+++ b/src/utils/rbac.test.ts
@@ -88,27 +88,12 @@ describe('getAllScopePermissions', () => {
});
describe('return value format', () => {
- it('should return an array of strings', () => {
- const result = getAllScopePermissions('AGENT_READ');
- expect(Array.isArray(result)).toBe(true);
- for (const permission of result) {
- expect(typeof permission).toBe('string');
- }
- });
-
it('should return permissions in format "resource:action:scope"', () => {
const result = getAllScopePermissions('KNOWLEDGE_BASE_CREATE');
for (const permission of result) {
expect(permission).toMatch(/^\w+:\w+:\w+$/);
}
});
-
- it('should filter out any undefined/empty values', () => {
- const result = getAllScopePermissions('AGENT_READ');
- for (const permission of result) {
- expect(permission).toBeTruthy();
- }
- });
});
});
diff --git a/src/utils/server/routeVariants.test.ts b/src/utils/server/routeVariants.test.ts
index a19fd9da97b..6a8ad5f32ee 100644
--- a/src/utils/server/routeVariants.test.ts
+++ b/src/utils/server/routeVariants.test.ts
@@ -102,12 +102,6 @@ describe('RouteVariants', () => {
expect(result).toEqual(DEFAULT_VARIANTS);
});
- it('should handle isMobile value correctly for "0"', () => {
- const serialized = 'en-US__0';
- const result = RouteVariants.deserializeVariants(serialized);
- expect(result.isMobile).toBe(false);
- });
-
it('should handle isMobile value correctly for "1"', () => {
const serialized = 'en-US__1';
const result = RouteVariants.deserializeVariants(serialized);