vnote_device_plugin_method_channel_test.dart 824 B

123456789101112131415161718192021222324252627
  1. import 'package:flutter/services.dart';
  2. import 'package:flutter_test/flutter_test.dart';
  3. import 'package:vnote_device_plugin/vnote_device_plugin_method_channel.dart';
  4. void main() {
  5. TestWidgetsFlutterBinding.ensureInitialized();
  6. MethodChannelVnoteDevicePlugin platform = MethodChannelVnoteDevicePlugin();
  7. const MethodChannel channel = MethodChannel('vnote_device_plugin');
  8. setUp(() {
  9. TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(
  10. channel,
  11. (MethodCall methodCall) async {
  12. return '42';
  13. },
  14. );
  15. });
  16. tearDown(() {
  17. TestDefaultBinaryMessengerBinding.instance.defaultBinaryMessenger.setMockMethodCallHandler(channel, null);
  18. });
  19. test('getPlatformVersion', () async {
  20. expect(await platform.getPlatformVersion(), '42');
  21. });
  22. }