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';
|
2015-10-10 06:22:20 +00:00
|
|
|
import 'package:sky_tools/src/commands/logs.dart';
|
2015-09-29 21:26:42 +00:00
|
|
|
import 'package:test/test.dart';
|
|
|
|
|
2015-10-12 02:42:50 +00:00
|
|
|
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', () {
|
2015-10-12 02:42:50 +00:00
|
|
|
LogsCommand command = new LogsCommand();
|
|
|
|
applyMocksToCommand(command);
|
|
|
|
MockDeviceStore mockDevices = command.devices;
|
2015-10-08 17:51:43 +00:00
|
|
|
|
2015-10-12 02:42:50 +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)));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|