fix:对齐金值,主要注销,一键登录等方面修改
This commit is contained in:
1 parent
e29ed0a2c8
commit
6997a65c96
37 files changed
+3442
-514
No files matched your search
@@ -4,6 +4,14 @@ import 'package:jinzhi_flutter_app/features/mall/application/mall_tab_config.dar
|
||||
void main() {
|
||||
test('preserves Jinzhi attribution while syncing H5 login', () {
|
||||
final arguments = buildEnterWebMallBridgeArguments(
|
||||
config: const MallTabConfig(
|
||||
enabled: true,
|
||||
url: 'https://mall.example.com/',
|
||||
adId: 'latest-ad',
|
||||
trackingId: 'latest-tracking',
|
||||
clickId: 'latest-click',
|
||||
entryRequest: MallEntryRequest.quoteRetailGold,
|
||||
),
|
||||
currentUri: Uri.parse(
|
||||
'https://mall.example.com/?from=jinzhi&source_app=jinzhi'
|
||||
'&source_entry=market_quote&placement=mall_tab&hook_type=quote_cta'
|
||||
@@ -15,11 +23,6 @@ void main() {
|
||||
authToken: 'mall-token',
|
||||
scene: 'web_mall',
|
||||
sourceApp: 'jinzhi',
|
||||
attribution: const MallClickAttribution(
|
||||
adId: 'latest-ad',
|
||||
trackingId: 'latest-tracking',
|
||||
clickId: 'latest-click',
|
||||
),
|
||||
);
|
||||
|
||||
expect(arguments['from'], 'jinzhi');
|
||||
|
||||
@@ -0,0 +1,66 @@
|
||||
import 'package:dio/dio.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:jinzhi_flutter_app/features/mall/application/mall_tab_config.dart';
|
||||
import 'package:jinzhi_flutter_app/models/pb/jinzhi/v1/ads.pb.dart' as pb;
|
||||
|
||||
void main() {
|
||||
test('keeps click attribution and reports the full generated event', () async {
|
||||
pb.ReportAdEventRequest? clickEvent;
|
||||
final dio = Dio()
|
||||
..interceptors.add(
|
||||
InterceptorsWrapper(
|
||||
onRequest: (options, handler) {
|
||||
if (options.path == '/api/v1/ads') {
|
||||
handler.resolve(
|
||||
Response<List<int>>(
|
||||
requestOptions: options,
|
||||
statusCode: 200,
|
||||
data: pb.GetAdReply(
|
||||
enabled: true,
|
||||
ad: pb.AdCreative(
|
||||
adId: 'ad-1',
|
||||
h5Url: 'https://mall.example.com',
|
||||
trackingId: 'tracking-1',
|
||||
openMode: pb.AdOpenMode.AD_OPEN_MODE_IN_APP,
|
||||
),
|
||||
).writeToBuffer(),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
if (options.path == '/api/v1/ads/events') {
|
||||
final event = pb.ReportAdEventRequest.fromBuffer(
|
||||
options.data as List<int>,
|
||||
);
|
||||
if (event.eventName == 'ad_click') clickEvent = event;
|
||||
handler.resolve(
|
||||
Response<List<int>>(
|
||||
requestOptions: options,
|
||||
statusCode: 200,
|
||||
data: pb.ReportAdEventReply().writeToBuffer(),
|
||||
),
|
||||
);
|
||||
return;
|
||||
}
|
||||
handler.next(options);
|
||||
},
|
||||
),
|
||||
);
|
||||
final controller = MallTabConfigController(dio, autoRefresh: false);
|
||||
await controller.refresh();
|
||||
|
||||
final clicked = await controller.recordClick(
|
||||
request: MallEntryRequest.quoteRetailGold,
|
||||
);
|
||||
|
||||
expect(clicked.clickId, isNotEmpty);
|
||||
expect(controller.state.clickId, clicked.clickId);
|
||||
expect(clickEvent?.clickId, clicked.clickId);
|
||||
expect(clickEvent?.attrs['source_app'], 'jinzhi');
|
||||
expect(clickEvent?.attrs['source_entry'], 'market_quote');
|
||||
expect(clickEvent?.attrs['hook_type'], 'quote_cta');
|
||||
expect(clickEvent?.attrs['entry_scene'], 'retail');
|
||||
expect(clickEvent?.attrs['entry_metal'], 'au');
|
||||
expect(clickEvent?.attrs['open_mode'], 'in_app');
|
||||
});
|
||||
}
|
||||
@@ -2,6 +2,7 @@ import 'dart:convert';
|
||||
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:jinzhi_flutter_app/features/mall/application/mall_tab_config.dart';
|
||||
import 'package:jinzhi_flutter_app/models/pb/jinzhi/v1/ads.pb.dart' as pb;
|
||||
|
||||
void main() {
|
||||
test('builds the resident mall URL with Jinzhi attribution and theme', () {
|
||||
@@ -102,6 +103,27 @@ void main() {
|
||||
expect(config.entryTipTitle, '新人礼:¥360 铂金订购券');
|
||||
expect(config.entryTipBody, '点击这里进商城');
|
||||
});
|
||||
|
||||
test('parses generated mall promotion and open-mode fields', () {
|
||||
final response = pb.GetAdReply(
|
||||
enabled: true,
|
||||
ad: pb.AdCreative(
|
||||
adId: 'ad-1',
|
||||
title: '会员商城',
|
||||
h5Url: 'https://mall.example.com',
|
||||
trackingId: 'tracking-1',
|
||||
openMode: pb.AdOpenMode.AD_OPEN_MODE_NATIVE_APP,
|
||||
mallPromotion: pb.MallPromotion(quoteCtaEnabled: true),
|
||||
),
|
||||
);
|
||||
|
||||
final config = parseMallTabConfigResponse(response.writeToBuffer());
|
||||
|
||||
expect(config.isVisible, isTrue);
|
||||
expect(config.openMode, 'native_app');
|
||||
expect(config.quoteCtaEnabled, isTrue);
|
||||
expect(config.allowedHosts, {'mall.example.com'});
|
||||
});
|
||||
}
|
||||
|
||||
List<int> _stringField(int tag, String value) =>
|
||||
|
||||
Reference in new issue
Block a user