flutter_smartscan_plugin_test.dart 1.2 KB

12345678910111213141516171819202122232425262728293031
  1. import 'package:flutter_test/flutter_test.dart';
  2. import 'package:flutter_smartscan_plugin/flutter_smartscan_plugin.dart';
  3. import 'package:flutter_smartscan_plugin/flutter_smartscan_plugin_platform_interface.dart';
  4. import 'package:flutter_smartscan_plugin/plugin_method_channel_native.dart';
  5. import 'package:plugin_platform_interface/plugin_platform_interface.dart';
  6. class MockFlutterSmartscanPluginPlatform
  7. with MockPlatformInterfaceMixin
  8. implements FlutterSmartscanPluginPlatform {
  9. @override
  10. Future<String?> getPlatformVersion() => Future.value('42');
  11. }
  12. void main() {
  13. final FlutterSmartscanPluginPlatform initialPlatform =
  14. FlutterSmartscanPluginPlatform.instance;
  15. test('$MethodChannelFlutterSmartscanPlugin is the default instance', () {
  16. expect(
  17. initialPlatform, isInstanceOf<MethodChannelFlutterSmartscanPlugin>());
  18. });
  19. test('getPlatformVersion', () async {
  20. FlutterSmartscanPlugin flutterSmartscanPlugin = FlutterSmartscanPlugin();
  21. MockFlutterSmartscanPluginPlatform fakePlatform =
  22. MockFlutterSmartscanPluginPlatform();
  23. FlutterSmartscanPluginPlatform.instance = fakePlatform;
  24. expect(await flutterSmartscanPlugin.getPlatformVersion(), '42');
  25. });
  26. }