Skip to content

Commit

Permalink
Use the standard info message formatting
Browse files Browse the repository at this point in the history
  • Loading branch information
caendesilva committed Nov 30, 2023
1 parent 2488ec8 commit d2b4108
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions app/Actions/GitCommitter.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,8 @@ public function execute($changes)
if (empty($files)) {
render(<<<'HTML'
<div class="mx-2">
<span class="text-green-500">Nothing to commit, working tree clean.</span>
<span class="px-2 bg-green text-gray uppercase font-bold mr-1">Info:</span>
<span>Nothing to commit, working tree clean.</span>
</div>
HTML
);
Expand Down Expand Up @@ -72,7 +73,8 @@ protected function commit(array $files)

render(sprintf(<<<'HTML'
<div class="mx-2">
<span class="text-green-500">%s</span>
<span class="px-2 bg-green text-gray uppercase font-bold mr-1">Success:</span>
<span>%s</span>
</div>
HTML, trim(Arr::last(explode("\n", trim($process->output())))))
);
Expand Down
4 changes: 2 additions & 2 deletions tests/Feature/GitCommitterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

expect($statusCode)->toBe(0)
->and($output)
->toContain('Nothing to commit, working tree clean.');
->toContain(' INFO: Nothing to commit, working tree clean.');
});

it('prints process error', function () {
Expand Down Expand Up @@ -118,5 +118,5 @@

expect($statusCode)->toBe(0)
->and($renderer->fetch())
->toBe(' 1 file changed, 1 insertion(+), 1 deletion(-) '.PHP_EOL);
->toBe(' SUCCESS: 1 file changed, 1 insertion(+), 1 deletion(-) '.PHP_EOL);
});

0 comments on commit d2b4108

Please sign in to comment.