[flutter_plugin_tools] Minor test cleanup (#4120)

- Updates the remaining tests (other than one that still needs to be
  converted to the new base command, which will be fixed then) that
  aren't using runCapturingPrint to do so to reduce test log spam.
- Simplifies and standardizes the matcher used for ToolExit in tests.
This commit is contained in:
stuartmorgan
2021-07-01 18:05:54 -07:00
committed by GitHub
parent edeb10a752
commit 4b77aaff42
8 changed files with 56 additions and 53 deletions

View File

@ -77,7 +77,7 @@ void main() {
group('Initial validation', () {
test('requires a package flag', () async {
await expectLater(() => commandRunner.run(<String>['publish-plugin']),
throwsA(const TypeMatcher<ToolExit>()));
throwsA(isA<ToolExit>()));
expect(
printedMessages.last, contains('Must specify a package to publish.'));
});
@ -90,7 +90,7 @@ void main() {
'iamerror',
'--no-push-tags'
]),
throwsA(const TypeMatcher<ToolExit>()));
throwsA(isA<ToolExit>()));
expect(printedMessages.last, contains('iamerror does not exist'));
});
@ -105,7 +105,7 @@ void main() {
testPluginName,
'--no-push-tags'
]),
throwsA(const TypeMatcher<ToolExit>()));
throwsA(isA<ToolExit>()));
expect(
printedMessages,
@ -119,7 +119,7 @@ void main() {
await expectLater(
() => commandRunner
.run(<String>['publish-plugin', '--package', testPluginName]),
throwsA(const TypeMatcher<ToolExit>()));
throwsA(isA<ToolExit>()));
expect(processRunner.results.last.stderr, contains('No such remote'));
});
@ -248,7 +248,7 @@ void main() {
'--no-push-tags',
'--no-tag-release',
]),
throwsA(const TypeMatcher<ToolExit>()));
throwsA(isA<ToolExit>()));
expect(printedMessages, contains('Publish foo failed.'));
});
@ -301,7 +301,7 @@ void main() {
testPluginName,
'--no-push-tags',
]),
throwsA(const TypeMatcher<ToolExit>()));
throwsA(isA<ToolExit>()));
expect(printedMessages, contains('Publish foo failed.'));
final String? tag = (await gitDir.runCommand(
@ -327,7 +327,7 @@ void main() {
'--package',
testPluginName,
]),
throwsA(const TypeMatcher<ToolExit>()));
throwsA(isA<ToolExit>()));
expect(printedMessages, contains('Tag push canceled.'));
});
@ -958,7 +958,7 @@ void main() {
await expectLater(
() => commandRunner.run(
<String>['publish-plugin', '--all-changed', '--base-sha=HEAD~']),
throwsA(const TypeMatcher<ToolExit>()));
throwsA(isA<ToolExit>()));
expect(processRunner.pushTagsArgs, isEmpty);
});