Centralize CLI output helpers
This commit is contained in:
@@ -247,7 +247,7 @@ func TestBatchOutputIncludesTopLevelNotificationDetails(t *testing.T) {
|
||||
if err := writeJSON(&stdout, result); err != nil {
|
||||
t.Fatalf("writeJSON() error = %v", err)
|
||||
}
|
||||
writeRunLogs(&stderr, result)
|
||||
writeBatchStatus(&stderr, result)
|
||||
|
||||
var decoded app.BatchResult
|
||||
if err := json.Unmarshal(stdout.Bytes(), &decoded); err != nil {
|
||||
@@ -294,7 +294,7 @@ func TestBatchOutputDoesNotExposeSecretLikeNotificationErrors(t *testing.T) {
|
||||
if err := writeJSON(&stdout, result); err != nil {
|
||||
t.Fatalf("writeJSON() error = %v", err)
|
||||
}
|
||||
writeRunLogs(&stderr, result)
|
||||
writeBatchStatus(&stderr, result)
|
||||
|
||||
for _, output := range []string{stdout.String(), stderr.String()} {
|
||||
if strings.Contains(output, "DISTRIBUTOR_SECRET_TOKEN") {
|
||||
@@ -306,7 +306,7 @@ func TestBatchOutputDoesNotExposeSecretLikeNotificationErrors(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunLogsIncludeSkippedBatchNotification(t *testing.T) {
|
||||
func TestBatchStatusIncludesSkippedBatchNotification(t *testing.T) {
|
||||
result := &app.BatchResult{
|
||||
Batch: app.BatchMorning,
|
||||
Total: 2,
|
||||
@@ -327,7 +327,7 @@ func TestRunLogsIncludeSkippedBatchNotification(t *testing.T) {
|
||||
if err := writeJSON(&stdout, result); err != nil {
|
||||
t.Fatalf("writeJSON() error = %v", err)
|
||||
}
|
||||
writeRunLogs(&stderr, result)
|
||||
writeBatchStatus(&stderr, result)
|
||||
|
||||
var decoded app.BatchResult
|
||||
if err := json.Unmarshal(stdout.Bytes(), &decoded); err != nil {
|
||||
@@ -344,7 +344,7 @@ func TestRunLogsIncludeSkippedBatchNotification(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRunLogsDoNotRepeatBatchNotificationErrorPerReport(t *testing.T) {
|
||||
func TestBatchStatusDoesNotRepeatBatchNotificationErrorPerReport(t *testing.T) {
|
||||
result := &app.BatchResult{
|
||||
Batch: app.BatchEvening,
|
||||
Total: 1,
|
||||
@@ -360,7 +360,7 @@ func TestRunLogsDoNotRepeatBatchNotificationErrorPerReport(t *testing.T) {
|
||||
}
|
||||
var stderr bytes.Buffer
|
||||
|
||||
writeRunLogs(&stderr, result)
|
||||
writeBatchStatus(&stderr, result)
|
||||
|
||||
if count := strings.Count(stderr.String(), "batchNotification "); count != 1 {
|
||||
t.Fatalf("stderr batch notification lines = %d, want one:\n%s", count, stderr.String())
|
||||
|
||||
Reference in New Issue
Block a user