@@ -2,12 +2,15 @@ import 'package:flagship/decision/api_manager.dart';
22import 'package:flagship/flagship.dart' ;
33import 'package:flagship/flagship_version.dart' ;
44import 'package:flagship/status.dart' ;
5+ import 'package:flagship/tracking/tracking_manager.dart' ;
56import 'package:flutter/widgets.dart' ;
67import 'package:flutter_test/flutter_test.dart' ;
78import 'package:http/http.dart' as http;
89import 'package:mockito/annotations.dart' ;
910import 'package:mockito/mockito.dart' ;
11+ import 'package:path_provider_platform_interface/path_provider_platform_interface.dart' ;
1012import 'package:shared_preferences/shared_preferences.dart' ;
13+ import 'fake_path_provider_platform.dart' ;
1114import 'service_test.mocks.dart' ;
1215import 'package:flagship/api/service.dart' ;
1316import 'package:flagship/flagship_config.dart' ;
@@ -16,29 +19,24 @@ import 'test_tools.dart';
1619
1720@GenerateMocks ([Service ])
1821void main () {
22+ PathProviderPlatform .instance = FakePathProviderPlatform ();
1923 ToolsTest .sqfliteTestInit ();
2024 WidgetsFlutterBinding .ensureInitialized ();
2125 SharedPreferences .setMockInitialValues ({});
2226 Flagship .start ("bkk9glocmjcg0vtmdlrr" , "apiKey" );
23- Map <String , String > fsHeaders = {
24- "x-api-key" : "apiKey" ,
25- "x-sdk-client" : "flutter" ,
26- "x-sdk-version" : FlagshipVersion ,
27- "Content-type" : "application/json"
28- };
2927
3028 MockService fakePanicService = MockService ();
3129 ApiManager fakePanicApi = ApiManager (fakePanicService);
3230 test ('Test API with panic mode' , () async {
3331 String fakeResponse =
3432 await ToolsTest .readFile ('test_resources/decisionApiPanic.json' ) ?? "" ;
3533 when (fakePanicService.sendHttpRequest (
36- RequestType .Post ,
37- 'https://decision.flagship.io/v2/bkk9glocmjcg0vtmdlrr/campaigns/?exposeAllKeys=true&extras[]=accountSettings' ,
38- fsHeaders ,
39- any,
40- timeoutMs: TIMEOUT ))
41- .thenAnswer ((_) async {
34+ RequestType .Post ,
35+ 'https://decision.flagship.io/v2/bkk9glocmjcg0vtmdlrr/campaigns/?exposeAllKeys=true&extras[]=accountSettings' ,
36+ any ,
37+ any,
38+ timeoutMs: TIMEOUT ,
39+ )) .thenAnswer ((_) async {
4240 return http.Response (fakeResponse, 200 );
4341 });
4442
0 commit comments