@@ -395,10 +395,8 @@ func TestLoadIndex_NotJSON(t *testing.T) {
395395 result , err := loadIndex (f .Name ())
396396
397397 // Assert
398- if assert .Error (t , err ) {
399- assert .Equal (t , "codacy-trivy/tool: Failed to decode malicious package index\n unexpected EOF" , err .Error ())
400- assert .Nil (t , result )
401- }
398+ assert .ErrorContains (t , err , "Failed to decode malicious package index" )
399+ assert .Nil (t , result )
402400}
403401
404402func TestLoadIndex_NotGz (t * testing.T ) {
@@ -422,21 +420,17 @@ func TestLoadIndex_NotGz(t *testing.T) {
422420 result , err := loadIndex (f .Name ())
423421
424422 // Assert
425- if assert .Error (t , err ) {
426- assert .Equal (t , "codacy-trivy/tool: Failed to read malicious package index\n unexpected EOF" , err .Error ())
427- assert .Nil (t , result )
428- }
423+ assert .ErrorContains (t , err , "Failed to read malicious package index" )
424+ assert .Nil (t , result )
429425}
430426
431427func TestLoadIndex_NotFound (t * testing.T ) {
432428 // Act
433429 result , err := loadIndex ("non-existent.json.gz" )
434430
435431 // Assert
436- if assert .Error (t , err ) {
437- assert .Equal (t , "codacy-trivy/tool: Failed to open malicious package index\n open non-existent.json.gz: no such file or directory" , err .Error ())
438- assert .Nil (t , result )
439- }
432+ assert .ErrorContains (t , err , "Failed to open malicious package index" )
433+ assert .Nil (t , result )
440434}
441435
442436func TestSemverCompare (t * testing.T ) {
0 commit comments