@@ -287,11 +287,7 @@ release:
287287foo: bar
288288''' );
289289
290- final CiConfig ? config = plugin.parseCiConfig ();
291-
292- expect (config, isNotNull);
293- expect (config! .errors, hasLength (1 ));
294- expect (config.errors[0 ], contains ('Unknown key `foo`' ));
290+ expect (() => plugin.parseCiConfig (), throwsFormatException);
295291 });
296292
297293 test ('reports invalid values' , () {
@@ -302,11 +298,7 @@ release:
302298 batch: not-a-bool
303299''' );
304300
305- final CiConfig ? config = plugin.parseCiConfig ();
306-
307- expect (config, isNotNull);
308- expect (config! .errors, hasLength (1 ));
309- expect (config.errors[0 ], contains ('Invalid value `not-a-bool`' ));
301+ expect (() => plugin.parseCiConfig (), throwsFormatException);
310302 });
311303 });
312304
@@ -315,22 +307,18 @@ release:
315307 final RepositoryPackage package =
316308 createFakePackage ('a_package' , packagesDir);
317309
318- final PendingChangelogs changelogs = package.getPendingChangelogs ();
319-
320- expect (changelogs.entries, isEmpty);
321- expect (changelogs.errors, hasLength (1 ));
322- expect (changelogs.errors[0 ], contains ('No pending_changelogs folder' ));
310+ expect (() => package.getPendingChangelogs (), throwsFormatException);
323311 });
324312
325313 test ('returns empty lists if the directory is empty' , () {
326314 final RepositoryPackage package =
327315 createFakePackage ('a_package' , packagesDir);
328316 package.pendingChangelogsDirectory.createSync ();
329317
330- final PendingChangelogs changelogs = package.getPendingChangelogs ();
318+ final List <PendingChangelogEntry > changelogs =
319+ package.getPendingChangelogs ();
331320
332- expect (changelogs.entries, isEmpty);
333- expect (changelogs.errors, isEmpty);
321+ expect (changelogs, isEmpty);
334322 });
335323
336324 test ('returns entries for valid files' , () {
@@ -350,14 +338,14 @@ changelog: B
350338version: minor
351339''' );
352340
353- final PendingChangelogs changelogs = package.getPendingChangelogs ();
341+ final List <PendingChangelogEntry > changelogs =
342+ package.getPendingChangelogs ();
354343
355- expect (changelogs.errors, isEmpty);
356- expect (changelogs.entries, hasLength (2 ));
357- expect (changelogs.entries[0 ].changelog, 'A' );
358- expect (changelogs.entries[0 ].version, VersionChange .patch);
359- expect (changelogs.entries[1 ].changelog, 'B' );
360- expect (changelogs.entries[1 ].version, VersionChange .minor);
344+ expect (changelogs, hasLength (2 ));
345+ expect (changelogs[0 ].changelog, 'A' );
346+ expect (changelogs[0 ].version, VersionChange .patch);
347+ expect (changelogs[1 ].changelog, 'B' );
348+ expect (changelogs[1 ].version, VersionChange .minor);
361349 });
362350
363351 test ('returns an error for a malformed file' , () {
@@ -368,12 +356,7 @@ version: minor
368356 package.pendingChangelogsDirectory.childFile ('a.yaml' );
369357 changelogFile.writeAsStringSync ('not yaml' );
370358
371- final PendingChangelogs changelogs = package.getPendingChangelogs ();
372-
373- expect (changelogs.entries, isEmpty);
374- expect (changelogs.errors, hasLength (1 ));
375- expect (
376- changelogs.errors[0 ], contains ('Malformed pending changelog file' ));
359+ expect (() => package.getPendingChangelogs (), throwsFormatException);
377360 });
378361
379362 test ('ignores template.yaml' , () {
@@ -393,11 +376,11 @@ changelog: TEMPLATE
393376version: skip
394377''' );
395378
396- final PendingChangelogs changelogs = package.getPendingChangelogs ();
379+ final List <PendingChangelogEntry > changelogs =
380+ package.getPendingChangelogs ();
397381
398- expect (changelogs.errors, isEmpty);
399- expect (changelogs.entries, hasLength (1 ));
400- expect (changelogs.entries[0 ].changelog, 'A' );
382+ expect (changelogs, hasLength (1 ));
383+ expect (changelogs[0 ].changelog, 'A' );
401384 });
402385
403386 test ('returns an error for a non-yaml file' , () {
@@ -414,11 +397,7 @@ version: patch
414397 .childFile ('a.txt' )
415398 .writeAsStringSync ('text' );
416399
417- final PendingChangelogs changelogs = package.getPendingChangelogs ();
418-
419- expect (changelogs.entries, hasLength (1 ));
420- expect (changelogs.errors, hasLength (1 ));
421- expect (changelogs.errors[0 ], contains ('Found non-YAML file' ));
400+ expect (() => package.getPendingChangelogs (), throwsFormatException);
422401 });
423402 });
424403}
0 commit comments