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); }); }