071faa482c
纳入 AGC Cargo workspace 的统一 rustfmt 检查与格式化入口 完成项目 TypeScript/Prettier 与 Rust 全量格式化 修复 Pingora expected executable 门禁的空白敏感误报 同步开发运维文档与 AGC skill pack 格式化忽略规则
58 lines
1.6 KiB
TypeScript
58 lines
1.6 KiB
TypeScript
import { describe, expect, test, vi } from 'vitest';
|
|
|
|
import {
|
|
HOST_BRIDGE_EXPO_MOBILE_BASE_CAPABILITIES,
|
|
HOST_BRIDGE_EXPO_MOBILE_IOS_CAPABILITIES,
|
|
} from '../../../../packages/shared/src/contracts/hostBridge';
|
|
import {
|
|
IOS_MOBILE_HOST_CAPABILITIES,
|
|
MOBILE_HOST_CAPABILITIES,
|
|
resolveMobileHostCapabilities,
|
|
} from './capabilities';
|
|
|
|
vi.mock('react-native', () => ({
|
|
Platform: {
|
|
OS: 'android',
|
|
},
|
|
}));
|
|
|
|
describe('mobile HostBridge capability profile', () => {
|
|
test('uses the shared Expo mobile capability profiles directly', () => {
|
|
expect(MOBILE_HOST_CAPABILITIES).toBe(
|
|
HOST_BRIDGE_EXPO_MOBILE_BASE_CAPABILITIES,
|
|
);
|
|
expect(IOS_MOBILE_HOST_CAPABILITIES).toBe(
|
|
HOST_BRIDGE_EXPO_MOBILE_IOS_CAPABILITIES,
|
|
);
|
|
});
|
|
|
|
test('keeps Android on the base profile without iOS-only badge support', () => {
|
|
expect(resolveMobileHostCapabilities('android')).toBe(
|
|
MOBILE_HOST_CAPABILITIES,
|
|
);
|
|
expect(resolveMobileHostCapabilities('android')).not.toContain(
|
|
'app.setBadgeCount',
|
|
);
|
|
});
|
|
|
|
test('adds only real iOS extra capabilities on iOS', () => {
|
|
expect(resolveMobileHostCapabilities('ios')).toBe(
|
|
IOS_MOBILE_HOST_CAPABILITIES,
|
|
);
|
|
expect(resolveMobileHostCapabilities('ios')).toEqual([
|
|
...MOBILE_HOST_CAPABILITIES,
|
|
'app.setBadgeCount',
|
|
]);
|
|
});
|
|
|
|
test('does not advertise SDK-backed capabilities before real native flows exist', () => {
|
|
for (const profile of [
|
|
MOBILE_HOST_CAPABILITIES,
|
|
IOS_MOBILE_HOST_CAPABILITIES,
|
|
]) {
|
|
expect(profile).not.toContain('auth.requestLogin');
|
|
expect(profile).not.toContain('payment.request');
|
|
}
|
|
});
|
|
});
|