补齐移动壳文件动作单测

移动壳 files helper 增加系统文件动作直接单测

移动壳配置门禁反查文件动作测试边界

宿主壳文档和共享决策同步移动文件动作覆盖
This commit is contained in:
2026-06-20 08:57:19 +08:00
parent 3873fdaf64
commit 05e7ca1015
6 changed files with 341 additions and 5 deletions
@@ -38,6 +38,8 @@ const dispatchPath = new URL('../src/host-bridge/dispatch.ts', import.meta.url);
const dispatchSource = fs.readFileSync(dispatchPath, 'utf8');
const filesPath = new URL('../src/host-bridge/files.ts', import.meta.url);
const filesSource = fs.readFileSync(filesPath, 'utf8');
const filesTestPath = new URL('../src/host-bridge/files.test.ts', import.meta.url);
const filesTestSource = fs.readFileSync(filesTestPath, 'utf8');
const filePayloadsPath = new URL(
'../src/host-bridge/filePayloads.ts',
import.meta.url,
@@ -1937,6 +1939,27 @@ for (const [wrapperName, fileCall] of [
}
}
for (const snippet of [
'describe(\'mobile HostBridge file actions\'',
'exportTextFile({',
'exportImageFile({',
'importTextFile()',
'importDocumentFile()',
'importAudioFile()',
'importImageFile()',
'captureImageFile()',
'exportAudioFile({',
"code: 'unsupported_capability'",
"code: 'cancelled'",
"message: 'camera permission denied'",
"mediaTypes: ['images']",
"options: { encoding: 'base64' }",
]) {
if (!filesTestSource.includes(snippet)) {
throw new Error(`mobile shell file action tests missing ${snippet}`);
}
}
if (
!dispatchSource.includes('exportMobileHostBridgeTextFile(request)') ||
!dispatchSource.includes('importMobileHostBridgeTextFile(request)') ||