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): 推荐入口测试跟随稳定回调的取值方式

Dashb23371830a42
diff --git a/apps/mobile/src/__tests__/remoteTaskSuggestions.test.ts b/apps/mobile/src/__tests__/remoteTaskSuggestions.test.ts
index bb4ec65728..49112d8545 100644
--- a/apps/mobile/src/__tests__/remoteTaskSuggestions.test.ts
+++ b/apps/mobile/src/__tests__/remoteTaskSuggestions.test.ts
@@ -139,19 +139,21 @@ describe("home recommendation connection readiness", () => {
describe("recommendation route target", () => {
it("passes the checked computer explicitly for both empty and template actions", () => {
const source = readTextLf(resolve(process.cwd(), "src/session/HomeSurface.tsx"), "utf8");
- const openBody = source.match(/const openNewSession = useCallback\([^\n]*=> \{([\s\S]*?)\n \}, \[guardedPush, home.primaryDevice/)?.[1];
+ const openBody = source.match(/const openNewSession = useCallback\([^\n]*=> \{([\s\S]*?)\n \}, \[guardedPush, t\]\);/)?.[1];
const suggestedBody = source.match(/const openSuggestedSession = useCallback\([^\n]*=> \{([\s\S]*?)\n \}, \[openNewSession/)?.[1];
expect(openBody).toBeTruthy();
expect(suggestedBody).toBeTruthy();
expect(source.match(/onSelect=\{openSuggestedSession\}/g)).toHaveLength(2);
expect(source.match(/onNewSession=\{\(\) => openSuggestedSession\(\)\}/g)).toHaveLength(2);
const open = new Function("project", "suggestion", "explicitDeviceId", "guardedPush", `
- const home = { primaryDevice: { deviceId: 'fallback', label: 'Fallback' } };
- const selectedDeviceId = null;
+ const newSessionTargetRef = { current: {
+ primaryDevice: { deviceId: 'fallback', label: 'Fallback' },
+ newSessionDeviceOptions: [{ deviceId: 'checked', name: 'Checked' }],
+ selectedDeviceId: null,
+ } };
// 推荐入口不带 origin,不应触发 composer 形变入场。
const origin = undefined;
const rememberComposerEntry = () => { throw new Error('unexpected composer morph'); };
- const newSessionDeviceOptions = [{ deviceId: 'checked', name: 'Checked' }];
const serializeNewSessionDeviceOptions = JSON.stringify;
const setError = (error) => { throw new Error(error); }, t = (key) => key;
${openBody}