@@ -207,7 +207,11 @@ func TestAddProjectSummary(t *testing.T) {
207207 assert .Equal (t , testTable .expectedPass , results .Projects [0 ].Summary .Pass )
208208 assert .Equal (t , testTable .expectedWarningCount , results .Projects [0 ].Summary .WarningCount )
209209 assert .Equal (t , testTable .expectedErrorCount , results .Projects [0 ].Summary .ErrorCount )
210- assert .Equal (t , fmt .Sprintf ("Finished linting project. Results:\n Warning count: %v\n Error count: %v\n Rules passed: %v" , testTable .expectedWarningCount , testTable .expectedErrorCount , testTable .expectedPass ), results .ProjectSummaryText (lintedProject ))
210+ if testTable .expectedErrorCount == 0 && testTable .expectedWarningCount == 0 {
211+ assert .Equal (t , "Linter results for project: no errors or warnings" , results .ProjectSummaryText (lintedProject ))
212+ } else {
213+ assert .Equal (t , fmt .Sprintf ("Linter results for project: %v ERRORS, %v WARNINGS" , testTable .expectedErrorCount , testTable .expectedWarningCount ), results .ProjectSummaryText (lintedProject ))
214+ }
211215 }
212216}
213217
@@ -290,7 +294,11 @@ func TestAddSummary(t *testing.T) {
290294 assert .Equal (t , testTable .expectedPass , results .Passed ())
291295 assert .Equal (t , testTable .expectedWarningCount , results .Summary .WarningCount )
292296 assert .Equal (t , testTable .expectedErrorCount , results .Summary .ErrorCount )
293- assert .Equal (t , fmt .Sprintf ("Finished linting projects. Results:\n Warning count: %v\n Error count: %v\n Rules passed: %v" , testTable .expectedWarningCount , testTable .expectedErrorCount , testTable .expectedPass ), results .SummaryText ())
297+ if testTable .expectedErrorCount == 0 && testTable .expectedWarningCount == 0 {
298+ assert .Equal (t , "Linter results for projects: no errors or warnings" , results .SummaryText ())
299+ } else {
300+ assert .Equal (t , fmt .Sprintf ("Linter results for projects: %v ERRORS, %v WARNINGS" , testTable .expectedErrorCount , testTable .expectedWarningCount ), results .SummaryText ())
301+ }
294302 }
295303}
296304
0 commit comments