Files
ch934x_serial/test/ch934x_serial_test.dart
T
2026-07-06 15:20:14 +08:00

29 lines
1022 B
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:ch934x_serial/ch934x_serial.dart';
import 'package:ch934x_serial/ch934x_serial_platform_interface.dart';
import 'package:ch934x_serial/ch934x_serial_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
class MockCh934xSerialPlatform
with MockPlatformInterfaceMixin
implements Ch934xSerialPlatform {
@override
Future<String?> getPlatformVersion() => Future.value('42');
}
void main() {
final Ch934xSerialPlatform initialPlatform = Ch934xSerialPlatform.instance;
test('$MethodChannelCh934xSerial is the default instance', () {
expect(initialPlatform, isInstanceOf<MethodChannelCh934xSerial>());
});
test('getPlatformVersion', () async {
Ch934xSerial ch934xSerialPlugin = Ch934xSerial();
MockCh934xSerialPlatform fakePlatform = MockCh934xSerialPlatform();
Ch934xSerialPlatform.instance = fakePlatform;
expect(await ch934xSerialPlugin.getPlatformVersion(), '42');
});
}