devices.test.dart 1.12 KB
Newer Older
1 2 3 4
// Copyright 2015 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

5
import 'package:flutter_tools/src/android/android_sdk.dart';
6
import 'package:flutter_tools/src/commands/devices.dart';
7
import 'package:flutter_tools/src/device.dart';
8 9
import 'package:test/test.dart';

10 11
import 'src/common.dart';
import 'src/context.dart';
12 13 14 15

main() => defineTests();

defineTests() {
16
  group('devices', () {
17
    testUsingContext('returns 0 when called', () {
18
      DevicesCommand command = new DevicesCommand();
19 20 21 22
      return createTestCommandRunner(command).run(['list']).then((int code) {
        expect(code, equals(0));
      });
    });
23

24
    testUsingContext('no error when no connected devices', () {
25
      DevicesCommand command = new DevicesCommand();
26 27 28 29 30 31 32
      return createTestCommandRunner(command).run(['list']).then((int code) {
        expect(code, equals(0));
        expect(testLogger.statusText, contains('No connected devices'));
      });
    }, overrides: <Type, dynamic>{
      AndroidSdk: null,
      DeviceManager: new DeviceManager()
33 34 35
    });
  });
}