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): 修复预览源码就绪状态的失效断言

Dash243579cc27fe
diff --git a/apps/mobile/src/__tests__/filePreviewPagerWiring.test.ts b/apps/mobile/src/__tests__/filePreviewPagerWiring.test.ts
index 3bb3f9aaf3..a4efc8ad0d 100644
--- a/apps/mobile/src/__tests__/filePreviewPagerWiring.test.ts
+++ b/apps/mobile/src/__tests__/filePreviewPagerWiring.test.ts
@@ -44,9 +44,14 @@ describe('remote file preview pager wiring', () => {
const textPage = source.slice(source.indexOf('function TextPreviewPage('), source.indexOf('function ImagePreviewPage('));
const sourceList = textPage.match(/<FlatList\s[\s\S]*?data=\{state.lines\}[\s\S]*?testID=\{visible \? 'filePreview.sourceReady' : undefined\}/);
expect(sourceList).not.toBeNull();
- // Loading/error pages and prefetched neighbours must not satisfy the wait.
- expect(textPage.indexOf(sourceList![0])).toBeGreaterThan(textPage.indexOf("if (state.status === 'loading')"));
- expect(textPage.indexOf(sourceList![0])).toBeGreaterThan(textPage.indexOf("if (state.status === 'unavailable')"));
+ // Guard protocol: Maestro file_browser.yaml / visual_files.yaml wait for sourceReady.
+ // Loading/error pages and prefetched neighbours must not satisfy that wait.
+ // Require both branches to exist: comparing a list offset with -1 silently passed.
+ const loadingBranch = textPage.indexOf("state.status === 'loading' ? (");
+ const unavailableBranch = textPage.indexOf("state.status === 'unavailable' ? (");
+ expect(loadingBranch).toBeGreaterThanOrEqual(0);
+ expect(unavailableBranch).toBeGreaterThan(loadingBranch);
+ expect(textPage.indexOf(sourceList![0])).toBeGreaterThan(unavailableBranch);
});
it('reserves horizontal gestures for the PDF WebView', () => {