bc3b464349
微信小程序 host-bridge 与 shell 文件改为职责命名 移动壳 host-bridge 与 shell 文件改为职责命名 更新原生壳结构门禁、微信 smoke 和宿主壳文档
29 lines
834 B
TypeScript
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',
|
|
});
|
|
});
|
|
});
|