Skip to content

Commit fe6a418

Browse files
committed
WMRUSTORE-38: Fix tests
1 parent 27e2a8d commit fe6a418

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

mindbox/test/mindbox_test.dart

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ void main() {
6464
test('When SDK was initialized, getToken() should return token', () async {
6565
final completer = Completer<String>();
6666

67-
Mindbox.instance.getTokens((deviceToken) => completer.complete(deviceToken));
67+
Mindbox.instance.getToken((deviceToken) => completer.complete(deviceToken));
6868

6969
final validConfig = Configuration(
7070
domain: 'domain',
@@ -77,6 +77,22 @@ void main() {
7777
expect(await completer.future, equals('dummy-token'));
7878
});
7979

80+
test('When SDK was initialized, getTokens() should return tokens', () async {
81+
final completer = Completer<String>();
82+
83+
Mindbox.instance.getTokens((deviceToken) => completer.complete(deviceToken));
84+
85+
final validConfig = Configuration(
86+
domain: 'domain',
87+
endpointIos: 'endpointIos',
88+
endpointAndroid: 'endpointAndroid',
89+
subscribeCustomerIfCreated: true);
90+
91+
Mindbox.instance.init(configuration: validConfig);
92+
93+
expect(await completer.future, equals('dummy-tokens'));
94+
});
95+
8096
test('When SDK was not initialized, getToken() should not return token',
8197
() async {
8298
final completer = Completer<String>();

mindbox_platform_interface/lib/src/types/mindbox_mock_method_call_handler.dart

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ Future mindboxMockMethodCallHandler(MethodCall methodCall) async {
1717
return Future.value('dummy-device-uuid');
1818
case 'getToken':
1919
return Future.value('dummy-token');
20+
case 'getTokens':
21+
return Future.value('dummy-tokens');
22+
case 'getSdkVersion':
23+
return Future.value('dummy-sdk-version');
2024
case 'executeSyncOperation':
2125
final String operationSystemName = methodCall.arguments[0];
2226
if (operationSystemName == 'dummy-validation-error') {
@@ -62,6 +66,6 @@ Future mindboxMockMethodCallHandler(MethodCall methodCall) async {
6266
}
6367
return Future.value('dummy-response');
6468
default:
65-
return 'dummy-sdk-version';
69+
return 'dummy-not-mocked';
6670
}
6771
}

0 commit comments

Comments
 (0)