This commit is contained in:
Developer
2026-07-06 15:20:14 +08:00
commit a6f13acb55
46 changed files with 1210 additions and 0 deletions
+28
View File
@@ -0,0 +1,28 @@
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');
});
}