From 5a9c6adfda83a50c2566bc0651374c6b3d820292 Mon Sep 17 00:00:00 2001
From: projectuser <projectuser@leon056.com>
Date: 星期五, 26 十一月 2021 14:28:20 +0800
Subject: [PATCH] init

---
 test/package_info_test.dart |   49 +++++++++++++++++++++++++++++++++++++++++++++++++
 1 files changed, 49 insertions(+), 0 deletions(-)

diff --git a/test/package_info_test.dart b/test/package_info_test.dart
new file mode 100644
index 0000000..47d48fd
--- /dev/null
+++ b/test/package_info_test.dart
@@ -0,0 +1,49 @@
+// Copyright 2019 The Flutter Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+import 'package:flutter/services.dart';
+import 'package:flutter_test/flutter_test.dart';
+import 'package:package_info/package_info.dart';
+
+void main() {
+  TestWidgetsFlutterBinding.ensureInitialized();
+
+  const MethodChannel channel =
+      MethodChannel('plugins.flutter.io/package_info');
+  List<MethodCall> log;
+
+  channel.setMockMethodCallHandler((MethodCall methodCall) async {
+    log.add(methodCall);
+    switch (methodCall.method) {
+      case 'getAll':
+        return <String, dynamic>{
+          'appName': 'package_info_example',
+          'buildNumber': '1',
+          'packageName': 'io.flutter.plugins.packageinfoexample',
+          'version': '1.0',
+        };
+      default:
+        assert(false);
+        return null;
+    }
+  });
+
+  setUp(() {
+    log = <MethodCall>[];
+  });
+
+  test('fromPlatform', () async {
+    final PackageInfo info = await PackageInfo.fromPlatform();
+    expect(info.appName, 'package_info_example');
+    expect(info.buildNumber, '1');
+    expect(info.packageName, 'io.flutter.plugins.packageinfoexample');
+    expect(info.version, '1.0');
+    expect(
+      log,
+      <Matcher>[
+        isMethodCall('getAll', arguments: null),
+      ],
+    );
+  });
+}

--
Gitblit v1.8.0