Skip to content

Commit 138885d

Browse files
authored
Merge pull request #601 from objectstack-ai/copilot/fix-ci-errors-one-more-time
2 parents 743424e + 2e353dd commit 138885d

7 files changed

Lines changed: 42 additions & 32 deletions

File tree

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

Lines changed: 20 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -307,8 +307,12 @@ describe('Console Application Simulation', () => {
307307
{ id: '2', name: 'Item 2', amount: 200 }
308308
];
309309

310+
const originalFind = mocks.MockDataSource.prototype.find;
310311
const findSpy = vi.spyOn(mocks.MockDataSource.prototype, 'find')
311-
.mockResolvedValue({ data: seedData });
312+
.mockImplementation(async function (this: any, objectName: string) {
313+
if (objectName === 'kitchen_sink') return { data: seedData };
314+
return originalFind.call(this, objectName);
315+
});
312316

313317
renderApp('/kitchen_sink');
314318

@@ -326,6 +330,8 @@ describe('Console Application Simulation', () => {
326330
expect(screen.getByText('Item 1')).toBeInTheDocument();
327331
}, { timeout: 5000 });
328332
expect(screen.getByText('Item 2')).toBeInTheDocument();
333+
334+
findSpy.mockRestore();
329335
});
330336

331337
});
@@ -728,7 +734,7 @@ describe('Kanban Integration', () => {
728734
data: initialData
729735
} as any);
730736

731-
vi.spyOn(mocks.MockDataSource.prototype, 'getObjectSchema').mockResolvedValue({
737+
const schemaSpy = vi.spyOn(mocks.MockDataSource.prototype, 'getObjectSchema').mockResolvedValue({
732738
name: 'project_task',
733739
fields: {
734740
title: { type: 'text', label: 'Title' },
@@ -772,6 +778,10 @@ describe('Kanban Integration', () => {
772778
// For now, we verify the component can handle the initial load
773779
// and that data source was called correctly
774780
expect(findSpy).toHaveBeenCalledWith('project_task', expect.any(Object));
781+
782+
// Restore spies to avoid affecting subsequent tests
783+
findSpy.mockRestore();
784+
schemaSpy.mockRestore();
775785
});
776786
});
777787

@@ -828,23 +838,23 @@ describe('Dashboard Integration', () => {
828838
};
829839

830840
it('Scenario A: Dashboard Page Rendering', async () => {
831-
renderApp('/dashboard/showcase_dashboard');
841+
renderApp('/dashboard/crm_dashboard');
832842

833843
await waitFor(() => {
834-
expect(screen.getByText(/Platform Showcase/i)).toBeInTheDocument();
835-
});
844+
expect(screen.getByText(/CRM Overview/i)).toBeInTheDocument();
845+
}, { timeout: 10000 });
836846

837-
expect(screen.getByText(/Records by Category/i)).toBeInTheDocument();
847+
expect(screen.getByText(/Revenue Trends/i)).toBeInTheDocument();
838848
});
839849

840850
it('Scenario B: Help Page Rendering', async () => {
841-
renderApp('/page/showcase_help');
851+
renderApp('/page/crm_help');
842852

843853
await waitFor(() => {
844-
expect(screen.getByText(/Platform Showcase/i)).toBeInTheDocument();
845-
});
854+
expect(screen.getByText(/CRM Help Guide/i)).toBeInTheDocument();
855+
}, { timeout: 10000 });
846856

847-
expect(screen.getByText(/Supported Field Types/i)).toBeInTheDocument();
857+
expect(screen.getByText(/Keyboard Shortcuts/i)).toBeInTheDocument();
848858
});
849859

850860
it('Scenario C: Component Registry Check', async () => {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ describe('AuditLogPage', () => {
130130
});
131131
wrap(<AuditLogPage />);
132132
await waitFor(() => {
133-
expect(mockFind).toHaveBeenCalledWith('sys_audit_log', expect.objectContaining({ $orderby: 'createdAt desc' }));
133+
expect(mockFind).toHaveBeenCalledWith('sys_audit_log', expect.objectContaining({ $orderby: { createdAt: 'desc' } }));
134134
});
135135
expect(screen.getByText('create')).toBeInTheDocument();
136136
});

apps/console/src/components/AppHeader.tsx

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,10 +64,22 @@ export function AppHeader({ appName, objects, connectionState, presenceUsers, ac
6464
try {
6565
const [presenceResult, activityResult] = await Promise.all([
6666
dataSource.find('sys_presence').catch(() => ({ data: [] })),
67-
dataSource.find('sys_activity', { $orderby: 'timestamp desc', $top: 20 }).catch(() => ({ data: [] })),
67+
dataSource.find('sys_activity', { $orderby: { timestamp: 'desc' }, $top: 20 }).catch(() => ({ data: [] })),
6868
]);
69-
if (presenceResult.data?.length) setApiPresenceUsers(presenceResult.data);
70-
if (activityResult.data?.length) setApiActivities(activityResult.data);
69+
if (presenceResult.data?.length) {
70+
const data = presenceResult.data as Record<string, unknown>[];
71+
const users = data.filter(
72+
(u): u is PresenceUser & Record<string, unknown> => typeof u.userId === 'string'
73+
);
74+
if (users.length) setApiPresenceUsers(users);
75+
}
76+
if (activityResult.data?.length) {
77+
const data = activityResult.data as Record<string, unknown>[];
78+
const items = data.filter(
79+
(a): a is ActivityItem & Record<string, unknown> => typeof a.type === 'string'
80+
);
81+
if (items.length) setApiActivities(items);
82+
}
7183
} catch {
7284
// Fallback to defaults handled below
7385
}

apps/console/src/pages/system/AuditLogPage.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ export function AuditLogPage() {
2525
if (!dataSource) return;
2626
setLoading(true);
2727
try {
28-
const result = await dataSource.find('sys_audit_log', { $orderby: 'createdAt desc' });
28+
const result = await dataSource.find('sys_audit_log', { $orderby: { createdAt: 'desc' } });
2929
setRecords(result.data || []);
3030
} catch {
3131
toast.error('Failed to load audit logs');

packages/plugin-detail/src/RelationshipGraph.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ function computeLayout(
9292
// Level 2+: related records of related records
9393
if (levels >= 2) {
9494
const ringRadius2 = Math.min(width, height) * 0.46;
95-
let level2Nodes: { node: GraphNode; parentX: number; parentY: number; parentId: string }[] = [];
95+
const level2Nodes: { node: GraphNode; parentX: number; parentY: number; parentId: string }[] = [];
9696

9797
level1Nodes.forEach((parentNode) => {
9898
const parentLayoutNode = nodes.find((n) => n.id === parentNode.id);

packages/plugin-grid/src/useGroupReorder.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* LICENSE file in the root directory of this source tree.
77
*/
88

9-
import { useState, useCallback, useMemo } from 'react';
9+
import { useState, useCallback, useEffect } from 'react';
1010

1111
export interface UseGroupReorderOptions {
1212
/** Initial ordered list of group keys. */
@@ -43,7 +43,7 @@ export function useGroupReorder({ groupKeys }: UseGroupReorderOptions): UseGroup
4343
const [draggingKey, setDraggingKey] = useState<string | null>(null);
4444

4545
// Keep internal order in sync when the source list changes (new groups added/removed).
46-
useMemo(() => {
46+
useEffect(() => {
4747
setOrder((prev) => {
4848
const prevSet = new Set(prev);
4949
const nextSet = new Set(groupKeys);

pnpm-lock.yaml

Lines changed: 2 additions & 14 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)