flutter create --template=plugin now include flutter unit test (#26456)
This commit is contained in:
committed by
Zachary Anderson
parent
cb2ac0a125
commit
d15a361244
@@ -11,6 +11,10 @@ dependencies:
|
||||
flutter:
|
||||
sdk: flutter
|
||||
|
||||
dev_dependencies:
|
||||
flutter_test:
|
||||
sdk: flutter
|
||||
|
||||
# For information on the generic Dart part of this file, see the
|
||||
# following page: https://www.dartlang.org/tools/pub/pubspec
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
import 'package:flutter/services.dart';
|
||||
import 'package:flutter_test/flutter_test.dart';
|
||||
import 'package:{{projectName}}/{{projectName}}.dart';
|
||||
|
||||
void main() {
|
||||
const MethodChannel channel = MethodChannel('{{projectName}}');
|
||||
|
||||
setUp(() {
|
||||
channel.setMockMethodCallHandler((MethodCall methodCall) async {
|
||||
return '42';
|
||||
});
|
||||
});
|
||||
|
||||
tearDown(() {
|
||||
channel.setMockMethodCallHandler(null);
|
||||
});
|
||||
|
||||
test('getPlatformVersion', () async {
|
||||
expect(await {{pluginDartClass}}.platformVersion, '42');
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user