flutter/packages/flutter_tools/test/logs_test.dart

31 lines
997 B
Dart
Raw Normal View History

2015-09-29 21:26:42 +00:00
// 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.
import 'package:args/command_runner.dart';
import 'package:mockito/mockito.dart';
import 'package:sky_tools/src/commands/logs.dart';
2015-09-29 21:26:42 +00:00
import 'package:test/test.dart';
import 'src/mocks.dart';
2015-09-29 21:26:42 +00:00
main() => defineTests();
defineTests() {
group('logs', () {
test('returns 0 when no device is connected', () {
LogsCommand command = new LogsCommand();
applyMocksToCommand(command);
MockDeviceStore mockDevices = command.devices;
2015-10-08 17:51:43 +00:00
when(mockDevices.android.isConnected()).thenReturn(false);
when(mockDevices.iOS.isConnected()).thenReturn(false);
when(mockDevices.iOSSimulator.isConnected()).thenReturn(false);
2015-09-29 21:26:42 +00:00
CommandRunner runner = new CommandRunner('test_flutter', '')
..addCommand(command);
runner.run(['logs']).then((int code) => expect(code, equals(0)));
});
});
}