1
0
mirror of https://github.com/flutter/samples.git synced 2026-03-30 16:23:23 +00:00

[federated_plugin] adds platform interface implementation and plugin implementation for Android (#503)

This commit is contained in:
Ayush Bherwani
2020-07-29 09:17:36 +05:30
committed by GitHub
parent 3bc860f5df
commit 6d909874db
19 changed files with 622 additions and 101 deletions

View File

@@ -7,21 +7,20 @@ import 'package:flutter_test/flutter_test.dart';
import 'package:federated_plugin/federated_plugin.dart';
void main() {
const channel = MethodChannel('federated_plugin');
TestWidgetsFlutterBinding.ensureInitialized();
setUp(() {
channel.setMockMethodCallHandler((methodCall) async {
return '42';
group('Federated Plugin Test', () {
final location = Location(latitude: 131.0, longitude: 221.0);
MethodChannel('location').setMockMethodCallHandler((call) async {
if (call.method == 'getLocation') {
return [location.longitude, location.latitude];
}
});
test('getLocation method test', () async {
final result = await getLocation();
expect(result.longitude, location.longitude);
expect(result.latitude, location.latitude);
});
});
tearDown(() {
channel.setMockMethodCallHandler(null);
});
test('getPlatformVersion', () async {
expect(await FederatedPlugin.platformVersion, '42');
});
}