Skip to content

Commit

Permalink
Test coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanoltman committed Jan 8, 2025
1 parent 02edae1 commit b2be080
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 3 deletions.
5 changes: 2 additions & 3 deletions packages/shorebird_cli/lib/src/artifact_builder.dart
Original file line number Diff line number Diff line change
Expand Up @@ -561,16 +561,15 @@ Either run `flutter pub get` manually, or follow the steps in ${cannotRunInVSCod
'build',
'windows',
'--release',
if (flavor != null) '--flavor=$flavor',
if (target != null) '--target=$target',
...args,
];

final buildProcess = await process.start(
executable,
arguments,
runInShell: true,
environment: base64PublicKey?.toPublicKeyEnv(),
// TODO(bryanoltman): support this
// environment: base64PublicKey?.toPublicKeyEnv(),
);

buildProcess.stdout
Expand Down
18 changes: 18 additions & 0 deletions packages/shorebird_cli/test/src/commands/preview_command_test.dart
Original file line number Diff line number Diff line change
Expand Up @@ -1882,6 +1882,24 @@ channel: ${DeploymentTrack.staging.channel}
});
});

group('when downloading release artifact fails', () {
setUp(() {
when(
() => artifactManager.downloadFile(any()),
).thenThrow(Exception('oops'));
});

test('returns code 70', () async {
final result = await runWithOverrides(command.run);
expect(result, equals(ExitCode.software.code));
verify(
() => artifactManager.downloadFile(
Uri.parse(releaseArtifactUrl),
),
).called(1);
});
});

group('when preview artifact is not cached', () {
setUp(() {
when(() => artifactManager.downloadFile(any()))
Expand Down

0 comments on commit b2be080

Please sign in to comment.