2015-09-30 22:24:39 +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.
|
|
|
|
|
|
|
|
library list_test;
|
|
|
|
|
|
|
|
import 'package:args/command_runner.dart';
|
|
|
|
import 'package:mockito/mockito.dart';
|
|
|
|
import 'package:sky_tools/src/list.dart';
|
|
|
|
import 'package:test/test.dart';
|
|
|
|
|
|
|
|
import 'src/common.dart';
|
|
|
|
|
|
|
|
main() => defineTests();
|
|
|
|
|
|
|
|
defineTests() {
|
|
|
|
group('list', () {
|
|
|
|
test('returns 0 when called', () {
|
2015-10-02 15:34:09 +00:00
|
|
|
applicationPackageSetup();
|
|
|
|
|
2015-09-30 22:24:39 +00:00
|
|
|
MockAndroidDevice android = new MockAndroidDevice();
|
|
|
|
// Avoid relying on adb being installed on the test system.
|
|
|
|
// Instead, cause the test to run the echo command.
|
|
|
|
when(android.adbPath).thenReturn('echo');
|
|
|
|
|
2015-10-02 15:34:09 +00:00
|
|
|
MockIOSDevice ios = new MockIOSDevice();
|
|
|
|
// Avoid relying on idevice* being installed on the test system.
|
|
|
|
// Instead, cause the test to run the echo command.
|
|
|
|
when(ios.informerPath).thenReturn('echo');
|
|
|
|
when(ios.installerPath).thenReturn('echo');
|
|
|
|
when(ios.listerPath).thenReturn('echo');
|
|
|
|
|
|
|
|
ListCommand command = new ListCommand(android: android, ios: ios);
|
2015-09-30 22:24:39 +00:00
|
|
|
CommandRunner runner = new CommandRunner('test_flutter', '')
|
|
|
|
..addCommand(command);
|
|
|
|
runner.run(['list']).then((int code) => expect(code, equals(0)));
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|