native_vision_test.dart 1.0 KB

12345678910111213141516171819202122232425262728
  1. import 'package:flutter_test/flutter_test.dart';
  2. import 'package:native_vision/native/native_vision.dart';
  3. import 'package:native_vision/native_vision_platform_interface.dart';
  4. import 'package:native_vision/native_vision_method_channel.dart';
  5. import 'package:plugin_platform_interface/plugin_platform_interface.dart';
  6. class MockNativeVisionPlatform
  7. with MockPlatformInterfaceMixin
  8. implements NativeVisionPlatform {
  9. @override
  10. Future<String?> getPlatformVersion() => Future.value('42');
  11. }
  12. void main() {
  13. final NativeVisionPlatform initialPlatform = NativeVisionPlatform.instance;
  14. test('$MethodChannelNativeVision is the default instance', () {
  15. expect(initialPlatform, isInstanceOf<MethodChannelNativeVision>());
  16. });
  17. test('getPlatformVersion', () async {
  18. NativeVision nativeVisionPlugin = NativeVision();
  19. MockNativeVisionPlatform fakePlatform = MockNativeVisionPlatform();
  20. NativeVisionPlatform.instance = fakePlatform;
  21. expect(await nativeVisionPlugin.getPlatformVersion(), '42');
  22. });
  23. }