Skip to content

Commit

Permalink
Fix unit test for loglevel
Browse files Browse the repository at this point in the history
  • Loading branch information
emawby authored and nan-li committed Jan 31, 2024
1 parent 664912c commit 1e1594f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion test/mock_channel.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ import 'package:flutter_test/flutter_test.dart';

class OneSignalMockChannelController {
MethodChannel _channel = const MethodChannel('OneSignal');
MethodChannel _debugChannel = const MethodChannel('OneSignal#debug');
MethodChannel _tagsChannel = const MethodChannel('OneSignal#tags');

late OneSignalState state;

OneSignalMockChannelController() {
this._channel.setMockMethodCallHandler(_handleMethod);
this._tagsChannel.setMockMethodCallHandler(_handleMethod);
this._debugChannel.setMockMethodCallHandler(_handleMethod);
}

void resetState() {
Expand Down Expand Up @@ -117,7 +119,7 @@ class OneSignalState {
}

void setLogLevel(Map<dynamic, dynamic> params) {
int? level = params['console'] as int?;
int? level = params['logLevel'] as int?;
int? visual = params['visual'] as int?;

if (level != null) this.logLevel = OSLogLevel.values[level];
Expand Down
2 changes: 1 addition & 1 deletion test/onesignalflutter_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ void main() {
channelController.resetState();
});

test('set set log level', () {
test('set log level', () {
OneSignal.Debug.setLogLevel(
OSLogLevel.info,
).then(expectAsync1((v) {
Expand Down

0 comments on commit 1e1594f

Please sign in to comment.