- 同步商城 H5 登录态与原生 token - 完善商城/原生 tab 切换、动画及返回交互 - 修复七鱼客服键盘避让和状态栏恢复 - 调整开屏跳过按钮与登录入口交互
45 lines
1.4 KiB
Dart
45 lines
1.4 KiB
Dart
import 'package:flutter_test/flutter_test.dart';
|
|
import 'package:jinzhi_flutter_app/features/mall/application/mall_tab_config.dart';
|
|
|
|
void main() {
|
|
test('builds the resident mall URL with Jinzhi attribution and theme', () {
|
|
const config = MallTabConfig(
|
|
enabled: true,
|
|
url: 'https://mall.example.com/home?campaign=gold',
|
|
adId: 'ad-1',
|
|
trackingId: 'tracking-1',
|
|
);
|
|
|
|
final uri = config.attributedUri(clickId: 'click-1', isDark: true)!;
|
|
|
|
expect(uri.queryParameters['campaign'], 'gold');
|
|
expect(uri.queryParameters['source_app'], 'jinzhi');
|
|
expect(uri.queryParameters['source_entry'], 'mall_tab');
|
|
expect(uri.queryParameters['ad_id'], 'ad-1');
|
|
expect(uri.queryParameters['tracking_id'], 'tracking-1');
|
|
expect(uri.queryParameters['click_id'], 'click-1');
|
|
expect(uri.queryParameters['isNight'], '1');
|
|
});
|
|
|
|
test('retains server open-mode metadata', () {
|
|
const resident = MallTabConfig(
|
|
enabled: true,
|
|
url: 'https://mall.example.com',
|
|
);
|
|
const nativeApp = MallTabConfig(
|
|
enabled: true,
|
|
url: 'https://mall.example.com',
|
|
openMode: 'native_app',
|
|
);
|
|
const external = MallTabConfig(
|
|
enabled: true,
|
|
url: 'https://mall.example.com',
|
|
openMode: 'external',
|
|
);
|
|
|
|
expect(resident.opensInApp, isTrue);
|
|
expect(nativeApp.opensInApp, isFalse);
|
|
expect(external.opensInApp, isFalse);
|
|
});
|
|
}
|