Files
zhiwen/test/zhiwen_test.dart
2026-03-31 08:51:45 +08:00

30 lines
903 B
Dart

import 'package:flutter_test/flutter_test.dart';
import 'package:zhiwen/zhiwen.dart';
import 'package:zhiwen/zhiwen_platform_interface.dart';
import 'package:zhiwen/zhiwen_method_channel.dart';
import 'package:plugin_platform_interface/plugin_platform_interface.dart';
class MockZhiwenPlatform
with MockPlatformInterfaceMixin
implements ZhiwenPlatform {
@override
Future<String?> getPlatformVersion() => Future.value('42');
}
void main() {
final ZhiwenPlatform initialPlatform = ZhiwenPlatform.instance;
test('$MethodChannelZhiwen is the default instance', () {
expect(initialPlatform, isInstanceOf<MethodChannelZhiwen>());
});
test('getPlatformVersion', () async {
Zhiwen zhiwenPlugin = Zhiwen();
MockZhiwenPlatform fakePlatform = MockZhiwenPlatform();
ZhiwenPlatform.instance = fakePlatform;
expect(await zhiwenPlugin.getPlatformVersion(), '42');
});
}