Skip to content

Commit d00842f

Browse files
committed
feat: update ObjectStack mocks and rename getIconComponent function for consistency
1 parent af15ff7 commit d00842f

File tree

3 files changed

+18
-9
lines changed

3 files changed

+18
-9
lines changed

apps/console/src/__tests__/BrowserSimulation.test.tsx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,9 @@ const mocks = vi.hoisted(() => {
5656
async create(_: string, data: any) { return { ...data, id: 'new_id' }; }
5757
async update(_: string, id: string, data: any) { return { ...data, id }; }
5858
async delete() { return true; }
59+
async connect() { return true; }
60+
onConnectionStateChange() {}
61+
discovery = {};
5962
}
6063

6164
class MockClient {
@@ -93,7 +96,8 @@ vi.mock('@objectstack/client', () => ({
9396

9497
// Important: Mock relative import used by App.tsx
9598
vi.mock('../dataSource', () => ({
96-
ObjectStackDataSource: mocks.MockDataSource
99+
ObjectStackAdapter: mocks.MockDataSource,
100+
ObjectStackDataSource: mocks.MockDataSource,
97101
}));
98102

99103
// --- 2. Import AppContent ---

apps/console/src/__tests__/ConsoleApp.test.tsx

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,14 +43,19 @@ vi.mock('@objectstack/client', () => {
4343
});
4444

4545
vi.mock('../dataSource', () => {
46+
const MockAdapter = class {
47+
find = vi.fn().mockResolvedValue([]);
48+
findOne = vi.fn();
49+
create = vi.fn();
50+
update = vi.fn();
51+
delete = vi.fn();
52+
connect = vi.fn().mockResolvedValue(true);
53+
onConnectionStateChange = vi.fn();
54+
discovery = {};
55+
};
4656
return {
47-
ObjectStackDataSource: class {
48-
find = vi.fn().mockResolvedValue([]);
49-
findOne = vi.fn();
50-
create = vi.fn();
51-
update = vi.fn();
52-
delete = vi.fn();
53-
}
57+
ObjectStackAdapter: MockAdapter,
58+
ObjectStackDataSource: MockAdapter,
5459
};
5560
});
5661

apps/console/src/components/AppSidebar.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ import { useExpressionContext, evaluateVisibility } from '../context/ExpressionP
5151
* Resolve a Lucide icon component by name string.
5252
* Supports camelCase, PascalCase, and kebab-case icon names.
5353
*/
54-
function getIconComponent(name?: string): React.ComponentType<any> {
54+
function getIcon(name?: string): React.ComponentType<any> {
5555
if (!name) return LucideIcons.Database;
5656

5757
// 1. Direct match (PascalCase or camelCase)

0 commit comments

Comments
 (0)