补齐移动壳扫码真实链路测试

新增 ShellApp 级扫码 HostBridge 测试覆盖 WebView 请求到相机扫码回注

移动壳 Vitest 纳入 TSX 组件测试

单端与根级原生壳门禁反查扫码链路测试存在
This commit is contained in:
2026-06-20 05:17:13 +08:00
parent 3c853da830
commit 6c0d929e91
4 changed files with 302 additions and 1 deletions
@@ -8,6 +8,8 @@ const appPath = new URL('../App.tsx', import.meta.url);
const appSource = fs.readFileSync(appPath, 'utf8');
const shellAppPath = new URL('../src/shell/ShellApp.tsx', import.meta.url);
const shellAppSource = fs.readFileSync(shellAppPath, 'utf8');
const shellAppTestPath = new URL('../src/shell/ShellApp.test.tsx', import.meta.url);
const shellAppTestSource = fs.readFileSync(shellAppTestPath, 'utf8');
const qrScannerOverlayPath = new URL('../src/shell/QrScannerOverlay.tsx', import.meta.url);
const qrScannerOverlaySource = fs.readFileSync(qrScannerOverlayPath, 'utf8');
const appearancePath = new URL('../src/host-bridge/appearance.ts', import.meta.url);
@@ -1858,6 +1860,18 @@ if (!shellAppSource.includes('<QrScannerOverlay />')) {
throw new Error('mobile shell ShellApp must render the QR scanner overlay');
}
for (const snippet of [
'scanner.scanQrCode',
'requestCameraPermissionsAsync',
'onBarcodeScanned',
'injectJavaScript',
'scan-request-1',
]) {
if (!shellAppTestSource.includes(snippet)) {
throw new Error(`mobile shell ShellApp QR scanner test missing ${snippet}`);
}
}
if (
!dispatchSource.includes('scanMobileHostBridgeQrCode(request)') ||
dispatchSource.includes('ok(request, await scanQrCode())')