Skip to content

Commit 3c21097

Browse files
check errs for m.run()
1 parent a473ecb commit 3c21097

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

cmd/notify-mailer/main_test.go

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,10 @@ func TestRunReadEmailsFrom(t *testing.T) {
917917
}
918918

919919
// Test that run() runs without error
920-
m.run(context.Background())
920+
err = m.run(context.Background())
921+
if err != nil {
922+
t.Error("Error running with readEmailsFrom flag")
923+
}
921924
}
922925

923926
// When saveEmailsTo flag set, test that resolveAdresses() and run() run correctly
@@ -962,8 +965,11 @@ func TestRunSaveEmailsTo(t *testing.T) {
962965
}
963966

964967
// Test that run() saves resolved addresses to saveEmailsTo
965-
m.run(context.Background())
968+
err = m.run(context.Background())
966969
defer os.Remove(m.saveEmailsTo)
970+
if err != nil {
971+
t.Error("Error running with saveEmailsTo flag")
972+
}
967973

968974
saveFile, err := os.ReadFile(m.saveEmailsTo)
969975
if err != nil {
@@ -1029,8 +1035,11 @@ func TestReadAndSaveBatchCase(t *testing.T) {
10291035

10301036
// Test that run() saves both a) emails extracted from readEmailsFrom and b) emails resolved
10311037
// by resolvedAddresses() in saveEmailsTo file
1032-
m.run(context.Background())
1038+
err = m.run(context.Background())
10331039
defer os.Remove(m.saveEmailsTo)
1040+
if err != nil {
1041+
t.Error("Error running with saveEmailsTo and readEmailsFrom flags")
1042+
}
10341043

10351044
saveFile, err := os.ReadFile(m.saveEmailsTo)
10361045
if err != nil {

0 commit comments

Comments
 (0)