Files
Genarrative/apps/mobile-shell/src/shell/lifecycle.test.ts
T
kdletters bc3b464349 统一三端桥接层职责命名
微信小程序 host-bridge 与 shell 文件改为职责命名

移动壳 host-bridge 与 shell 文件改为职责命名

更新原生壳结构门禁、微信 smoke 和宿主壳文档
2026-06-18 17:48:03 +08:00

29 lines
834 B
TypeScript

import { describe, expect, test } from 'vitest';
import { lifecyclePayloadFromAppState } from './lifecycle';
describe('lifecycle', () => {
test('把 React Native AppState 映射为统一 HostBridge 生命周期状态', () => {
expect(lifecyclePayloadFromAppState('active')).toEqual({
state: 'active',
focused: true,
nativeState: 'active',
});
expect(lifecyclePayloadFromAppState('background')).toEqual({
state: 'background',
focused: false,
nativeState: 'background',
});
expect(lifecyclePayloadFromAppState('inactive')).toEqual({
state: 'inactive',
focused: false,
nativeState: 'inactive',
});
expect(lifecyclePayloadFromAppState('unknown')).toEqual({
state: 'inactive',
focused: false,
nativeState: 'unknown',
});
});
});