Unverified Commit 0407a318 authored by Jenn Magder's avatar Jenn Magder Committed by GitHub

Replace clean command test functions with test groups (#51508)

parent cd97f23a
......@@ -18,16 +18,27 @@ import '../../src/common.dart';
import '../../src/context.dart';
void main() {
void test1() {
final MemoryFileSystem fs = MemoryFileSystem();
final MockXcodeProjectInterpreter mockXcodeProjectInterpreter = MockXcodeProjectInterpreter();
final MockXcode mockXcode = MockXcode();
group('clean command', () {
MockXcode mockXcode;
setUp(() {
mockXcode = MockXcode();
});
group('general', () {
MemoryFileSystem fs;
MockXcodeProjectInterpreter mockXcodeProjectInterpreter;
Directory buildDirectory;
FlutterProject projectUnderTest;
setUp(() {
fs = MemoryFileSystem();
mockXcodeProjectInterpreter = MockXcodeProjectInterpreter();
final Directory currentDirectory = fs.currentDirectory;
final Directory buildDirectory = currentDirectory.childDirectory('build');
buildDirectory = currentDirectory.childDirectory('build');
buildDirectory.createSync(recursive: true);
final FlutterProject projectUnderTest = FlutterProject.fromDirectory(currentDirectory);
projectUnderTest = FlutterProject.fromDirectory(currentDirectory);
projectUnderTest.ios.xcodeWorkspace.createSync(recursive: true);
projectUnderTest.macos.xcodeWorkspace.createSync(recursive: true);
......@@ -37,6 +48,7 @@ void main() {
projectUnderTest.linux.ephemeralDirectory.createSync(recursive: true);
projectUnderTest.macos.ephemeralDirectory.createSync(recursive: true);
projectUnderTest.windows.ephemeralDirectory.createSync(recursive: true);
});
testUsingContext('$CleanCommand removes build and .dart_tool and ephemeral directories, cleans Xcode', () async {
when(mockXcode.isInstalledAndMeetsVersionCheck).thenReturn(true);
......@@ -57,11 +69,14 @@ void main() {
Xcode: () => mockXcode,
XcodeProjectInterpreter: () => mockXcodeProjectInterpreter,
});
}
});
group('Windows', () {
MockPlatform windowsPlatform;
setUp(() {
windowsPlatform = MockPlatform();
});
void test2() {
final MockXcode mockXcode = MockXcode();
final MockPlatform windowsPlatform = MockPlatform();
testUsingContext('$CleanCommand prints a helpful error message on Windows', () async {
when(mockXcode.isInstalledAndMeetsVersionCheck).thenReturn(false);
when(windowsPlatform.isWindows).thenReturn(true);
......@@ -94,10 +109,8 @@ void main() {
Platform: () => windowsPlatform,
Xcode: () => mockXcode,
});
}
test1();
test2();
});
});
}
class MockFile extends Mock implements File {}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment