Skip to content

Commit 6e6f105

Browse files
Add test coverage for Surveys
1 parent 5025e39 commit 6e6f105

File tree

2 files changed

+17
-2
lines changed

2 files changed

+17
-2
lines changed

lib/Surveys.dart

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
11
// ignore_for_file: avoid_classes_with_only_static_members
22

33
import 'dart:async';
4-
import 'dart:io' show Platform;
54

65
import 'package:flutter/services.dart';
6+
import 'package:instabug_flutter/utils/platform_manager.dart';
77

88
class Surveys {
99
static Function? _onShowCallback;
@@ -131,7 +131,7 @@ class Surveys {
131131
/// NPS Surveys or AppRating Surveys to AppStore to let users rate your app on AppStore itself.
132132
/// [appStoreURL] A String url for the published iOS app on AppStore
133133
static Future<void> setAppStoreURL(String appStoreURL) async {
134-
if (Platform.isIOS) {
134+
if (PlatformManager.instance.isIOS()) {
135135
final List<dynamic> params = <dynamic>[appStoreURL];
136136
await _channel.invokeMethod<Object>('setAppStoreURL:', params);
137137
}

test/instabug_flutter_test.dart

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -704,6 +704,21 @@ void main() {
704704
]);
705705
});
706706

707+
test('setAppStoreURL Test', () async {
708+
const appStoreURL = 'appStoreURL';
709+
final List<dynamic> args = <dynamic>[appStoreURL];
710+
711+
when(mockPlatform.isIOS()).thenAnswer((_) => true);
712+
713+
Surveys.setAppStoreURL(appStoreURL);
714+
expect(log, <Matcher>[
715+
isMethodCall(
716+
'setAppStoreURL:',
717+
arguments: args,
718+
)
719+
]);
720+
});
721+
707722
test('showFeatureRequests Test', () async {
708723
FeatureRequests.show();
709724
expect(

0 commit comments

Comments
 (0)