Skip to content

armgit / cindy

Public Imported from GitHub
0

Consider it done. The open-source AI agent that works out of the box · 想到,就能做到。开源、开箱即用的 AI Agent。

test(mobile): provide route bindings for goal send callbacks

DavidShen4e9abdbe8973
diff --git a/apps/mobile/src/__tests__/mobileGoalCommands.test.ts b/apps/mobile/src/__tests__/mobileGoalCommands.test.ts
index fc7d3df4c7..4df317130d 100644
--- a/apps/mobile/src/__tests__/mobileGoalCommands.test.ts
+++ b/apps/mobile/src/__tests__/mobileGoalCommands.test.ts
@@ -74,6 +74,7 @@ function existingHarness(args = 'target') {
isRemoteSessionMissing: () => false, readSessionRowNow: () => session, goalBusy: false, setGoalBusy: vi.fn(),
executeMobileGoalCommand, sessionId: 'existing-task', deviceId: 'host', deviceIdRef: { current: 'host' },
outboxSessionAliveRef: { current: 'existing-task' }, getMobileAuthOwner: () => ({}), isMobileAuthOwnerCurrent: () => true,
+ params: {}, readRouteParam: (value: string | undefined) => value ?? null,
maker: { goal: { set: vi.fn(async () => {}), clear: vi.fn(async () => {}), getStatus: vi.fn(async () => ({ status: 'active', objective: 'target' })) } },
remoteSessionStore: { setGoalStatus: vi.fn(), acquireSessionMessageWork: vi.fn(() => ({ release })), getSessionDeviceId: () => 'host' }, setContextSheetView: vi.fn(), setContextSheetOpen: vi.fn(),
setGoalRestore: vi.fn(), router: { setParams: vi.fn() }, composerDocumentRef: { current: initial },
@@ -212,7 +213,9 @@ describe('existing task /goal send boundary', () => {
h.bindings.goalBusy = false;
h.bindings.attachmentsRef.current = [];
h.bindings.composerDocumentRef.current = textComposerDocument('ordinary follow-up');
+ h.bindings.setError.mockClear();
await h.run();
+ expect(h.bindings.setError).toHaveBeenCalledExactlyOnceWith(null);
expect(h.bindings.mobileDurableOutbox.add).toHaveBeenCalledExactlyOnceWith(expect.objectContaining({
item: expect.objectContaining({ sessionId: 'existing-task', text: 'ordinary follow-up' }),
}));