22// Use of this source code is governed by a BSD-style license that can be
33// found in the LICENSE file.
44
5- import 'dart:convert' ;
6-
7- import 'package:flutter_tools/src/android/android_studio.dart' ;
85import 'package:flutter_tools/src/base/config.dart' ;
9- import 'package:flutter_tools/src/base/context.dart' ;
106import 'package:flutter_tools/src/base/file_system.dart' ;
11- import 'package:flutter_tools/src/base/logger.dart' ;
12- import 'package:flutter_tools/src/commands/config.dart' ;
13- import 'package:mockito/mockito.dart' ;
147import 'package:test/test.dart' ;
158
16- import 'src/context.dart' ;
17-
189void main () {
1910 Config config;
20- MockAndroidStudio mockAndroidStudio;
2111
2212 setUp (() {
2313 final Directory tempDirectory = fs.systemTempDirectory.createTempSync ('flutter_test' );
2414 final File file = fs.file (fs.path.join (tempDirectory.path, '.settings' ));
2515 config = new Config (file);
26- mockAndroidStudio = new MockAndroidStudio ();
2716 });
2817
2918 group ('config' , () {
@@ -34,6 +23,12 @@ void main() {
3423 expect (config.keys, contains ('foo' ));
3524 });
3625
26+ test ('containsKey' , () async {
27+ expect (config.containsKey ('foo' ), false );
28+ config.setValue ('foo' , 'bar' );
29+ expect (config.containsKey ('foo' ), true );
30+ });
31+
3732 test ('removeValue' , () async {
3833 expect (config.getValue ('foo' ), null );
3934 config.setValue ('foo' , 'bar' );
@@ -43,24 +38,5 @@ void main() {
4338 expect (config.getValue ('foo' ), null );
4439 expect (config.keys, isNot (contains ('foo' )));
4540 });
46-
47- testUsingContext ('machine flag' , () async {
48- final BufferLogger logger = context[Logger ];
49- final ConfigCommand command = new ConfigCommand ();
50- await command.handleMachine ();
51-
52- expect (logger.statusText, isNotEmpty);
53- final dynamic json = JSON .decode (logger.statusText);
54- expect (json, isMap);
55- expect (json.containsKey ('android-studio-dir' ), true );
56- expect (json['android-studio-dir' ], isNotNull);
57- }, overrides: < Type , Generator > {
58- AndroidStudio : () => mockAndroidStudio,
59- });
6041 });
6142}
62-
63- class MockAndroidStudio extends Mock implements AndroidStudio , Comparable <AndroidStudio > {
64- @override
65- String get directory => 'path/to/android/stdio' ;
66- }
0 commit comments