@@ -17,133 +17,78 @@ void main() {
1717 methodChannelNetworkInfo = MethodChannelNetworkInfo ();
1818
1919 TestDefaultBinaryMessengerBinding .instance.defaultBinaryMessenger
20- .setMockMethodCallHandler (
21- methodChannelNetworkInfo.methodChannel,
22- (MethodCall methodCall) async {
23- log.add (methodCall);
24- switch (methodCall.method) {
25- case 'wifiName' :
26- return '1337wifi' ;
27- case 'wifiBSSID' :
28- return 'c0:ff:33:c0:d3:55' ;
29- case 'wifiIPAddress' :
30- return '127.0.0.1' ;
31- case 'wifiIPv6Address' :
32- return '2002:7f00:0001:0:0:0:0:0' ;
33- case 'wifiBroadcast' :
34- return '127.0.0.255' ;
35- case 'wifiGatewayAddress' :
36- return '127.0.0.0' ;
37- case 'wifiSubmask' :
38- return '255.255.255.0' ;
39- case 'requestLocationServiceAuthorization' :
40- return 'authorizedAlways' ;
41- case 'getLocationServiceAuthorization' :
42- return 'authorizedAlways' ;
43- default :
44- return null ;
45- }
46- },
47- );
20+ .setMockMethodCallHandler (methodChannelNetworkInfo.methodChannel, (
21+ MethodCall methodCall,
22+ ) async {
23+ log.add (methodCall);
24+ switch (methodCall.method) {
25+ case 'wifiName' :
26+ return '1337wifi' ;
27+ case 'wifiBSSID' :
28+ return 'c0:ff:33:c0:d3:55' ;
29+ case 'wifiIPAddress' :
30+ return '127.0.0.1' ;
31+ case 'wifiIPv6Address' :
32+ return '2002:7f00:0001:0:0:0:0:0' ;
33+ case 'wifiBroadcast' :
34+ return '127.0.0.255' ;
35+ case 'wifiGatewayAddress' :
36+ return '127.0.0.0' ;
37+ case 'wifiSubmask' :
38+ return '255.255.255.0' ;
39+ case 'requestLocationServiceAuthorization' :
40+ return 'authorizedAlways' ;
41+ case 'getLocationServiceAuthorization' :
42+ return 'authorizedAlways' ;
43+ default :
44+ return null ;
45+ }
46+ });
4847 log.clear ();
4948 });
5049
5150 test ('getWifiName' , () async {
5251 final result = await methodChannelNetworkInfo.getWifiName ();
5352 expect (result, '1337wifi' );
54- expect (
55- log,
56- < Matcher > [
57- isMethodCall (
58- 'wifiName' ,
59- arguments: null ,
60- ),
61- ],
62- );
53+ expect (log, < Matcher > [isMethodCall ('wifiName' , arguments: null )]);
6354 });
6455
6556 test ('getWifiBSSID' , () async {
6657 final result = await methodChannelNetworkInfo.getWifiBSSID ();
6758 expect (result, 'c0:ff:33:c0:d3:55' );
68- expect (
69- log,
70- < Matcher > [
71- isMethodCall (
72- 'wifiBSSID' ,
73- arguments: null ,
74- ),
75- ],
76- );
59+ expect (log, < Matcher > [isMethodCall ('wifiBSSID' , arguments: null )]);
7760 });
7861
7962 test ('getWifiIP' , () async {
8063 final result = await methodChannelNetworkInfo.getWifiIP ();
8164 expect (result, '127.0.0.1' );
82- expect (
83- log,
84- < Matcher > [
85- isMethodCall (
86- 'wifiIPAddress' ,
87- arguments: null ,
88- ),
89- ],
90- );
65+ expect (log, < Matcher > [isMethodCall ('wifiIPAddress' , arguments: null )]);
9166 });
9267
9368 test ('getWifiIPv6' , () async {
9469 final result = await methodChannelNetworkInfo.getWifiIPv6 ();
9570 expect (result, '2002:7f00:0001:0:0:0:0:0' );
96- expect (
97- log,
98- < Matcher > [
99- isMethodCall (
100- 'wifiIPv6Address' ,
101- arguments: null ,
102- ),
103- ],
104- );
71+ expect (log, < Matcher > [isMethodCall ('wifiIPv6Address' , arguments: null )]);
10572 });
10673
10774 test ('getWifiBroadcast' , () async {
10875 final result = await methodChannelNetworkInfo.getWifiBroadcast ();
10976 expect (result, '127.0.0.255' );
110- expect (
111- log,
112- < Matcher > [
113- isMethodCall (
114- 'wifiBroadcast' ,
115- arguments: null ,
116- ),
117- ],
118- );
77+ expect (log, < Matcher > [isMethodCall ('wifiBroadcast' , arguments: null )]);
11978 });
12079
12180 test ('getWifiGatewayIP' , () async {
12281 final result = await methodChannelNetworkInfo.getWifiGatewayIP ();
12382 expect (result, '127.0.0.0' );
124- expect (
125- log,
126- < Matcher > [
127- isMethodCall (
128- 'wifiGatewayAddress' ,
129- arguments: null ,
130- ),
131- ],
132- );
83+ expect (log, < Matcher > [
84+ isMethodCall ('wifiGatewayAddress' , arguments: null ),
85+ ]);
13386 });
13487
13588 test ('getWifiSubmask' , () async {
13689 final result = await methodChannelNetworkInfo.getWifiSubmask ();
13790 expect (result, '255.255.255.0' );
138- expect (
139- log,
140- < Matcher > [
141- isMethodCall (
142- 'wifiSubmask' ,
143- arguments: null ,
144- ),
145- ],
146- );
91+ expect (log, < Matcher > [isMethodCall ('wifiSubmask' , arguments: null )]);
14792 });
14893 });
14994}
0 commit comments