added cleanContext (#93264)
* added cleanContext * using async * added one more test
This commit is contained in:
@@ -15,6 +15,7 @@ void main() {
|
||||
group('clean command', () {
|
||||
const String flutterRoot = '/flutter';
|
||||
const String checkoutsParentDirectory = '$flutterRoot/dev/tools/';
|
||||
const String stateFilePath = '/state-file.json';
|
||||
|
||||
late MemoryFileSystem fileSystem;
|
||||
late FakePlatform platform;
|
||||
@@ -47,24 +48,36 @@ void main() {
|
||||
});
|
||||
|
||||
test('throws if no state file found', () async {
|
||||
const String stateFile = '/state-file.json';
|
||||
|
||||
await expectLater(
|
||||
() async => runner.run(<String>[
|
||||
'clean',
|
||||
'--$kStateOption',
|
||||
stateFile,
|
||||
stateFilePath,
|
||||
'--$kYesFlag',
|
||||
]),
|
||||
throwsExceptionWith(
|
||||
'No persistent state file found at $stateFile',
|
||||
'No persistent state file found at $stateFilePath',
|
||||
),
|
||||
);
|
||||
});
|
||||
|
||||
test('deletes state file', () async {
|
||||
final File stateFile = fileSystem.file('/state-file.json');
|
||||
stateFile.writeAsStringSync('{}');
|
||||
test('deletes an empty state file', () async {
|
||||
final File stateFile = fileSystem.file(stateFilePath);
|
||||
stateFile.writeAsStringSync('');
|
||||
|
||||
await runner.run(<String>[
|
||||
'clean',
|
||||
'--$kStateOption',
|
||||
stateFile.path,
|
||||
'--$kYesFlag',
|
||||
]);
|
||||
|
||||
expect(stateFile.existsSync(), false);
|
||||
});
|
||||
|
||||
test('deletes a state file with content', () async {
|
||||
final File stateFile = fileSystem.file(stateFilePath);
|
||||
stateFile.writeAsStringSync('{status: pending}');
|
||||
|
||||
await runner.run(<String>[
|
||||
'clean',
|
||||
|
||||
Reference in New Issue
Block a user