补齐移动壳导航单测

移动壳 navigation helper 增加独立单测覆盖

原生壳结构门禁登记移动导航测试

宿主壳文档和共享决策同步导航测试边界
This commit is contained in:
2026-06-20 08:24:07 +08:00
parent 29bce53669
commit fb02e89fa3
6 changed files with 216 additions and 2 deletions
@@ -48,6 +48,14 @@ const hostBridgeNavigationSource = fs.readFileSync(
hostBridgeNavigationPath,
'utf8',
);
const hostBridgeNavigationTestPath = new URL(
'../src/host-bridge/navigation.test.ts',
import.meta.url,
);
const hostBridgeNavigationTestSource = fs.readFileSync(
hostBridgeNavigationTestPath,
'utf8',
);
const hostBridgeNetworkPath = new URL(
'../src/host-bridge/network.ts',
import.meta.url,
@@ -1928,6 +1936,22 @@ if (
'mobile shell app.openExternalUrl must normalize payloads and use the shared external navigation helper',
);
}
for (const snippet of [
'openMobileHostBridgeExternalUrl',
'openMobileHostBridgeNativePage',
'reloadMobileHostBridgeWebView',
'Linking.canOpenURL',
'Linking.openURL',
'javascript:alert(1)',
'external URL cannot be opened',
'navigation.openNativePage unsupported in mobile shell',
'app.reloadWebView unsupported in mobile shell',
'hostCapabilities',
]) {
if (!hostBridgeNavigationTestSource.includes(snippet)) {
throw new Error(`mobile shell HostBridge navigation test missing ${snippet}`);
}
}
if (
!clipboardSource.includes(
'const clipboardText = normalizeHostBridgeClipboardText(',