1
This commit is contained in:
31
test/ch34_method_channel_test.dart
Normal file
31
test/ch34_method_channel_test.dart
Normal file
@@ -0,0 +1,31 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:ch34/src/ch34_method_channel.dart';
|
||||
import 'package:ch34/src/ch34_platform_interface.dart';
|
||||
|
||||
void main() {
|
||||
TestWidgetsFlutterBinding.ensureInitialized();
|
||||
|
||||
MethodChannelCh34.registerDefault();
|
||||
MethodChannelCh34 platform = Ch34Platform.instance as MethodChannelCh34;
|
||||
const MethodChannel channel = MethodChannel('ch34');
|
||||
|
||||
setUp(() {
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(
|
||||
channel,
|
||||
(MethodCall methodCall) async {
|
||||
return '42';
|
||||
},
|
||||
);
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger
|
||||
.setMockMethodCallHandler(channel, null);
|
||||
});
|
||||
|
||||
test('getPlatformVersion', () async {
|
||||
expect(await platform.getPlatformVersion(), '42');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user