Skip to content

Commit

Permalink
✅ Fixed Tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Templum committed Jul 21, 2023
1 parent a99a83c commit 10644b6
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion pkg/github/sarif_report_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ type MockReport struct {
mock.Mock
}

func (m *MockReport) Convert(findings []types.Finding) error {
func (m *MockReport) Convert(findings *types.Report) error {
args := m.Called(findings)
return args.Error(0)
}
Expand Down
6 changes: 3 additions & 3 deletions pkg/sarif/reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,16 +29,16 @@ func TestSarifReporter_Convert(t *testing.T) {
assert.NotNil(t, ref.report, "should have create an empty report")
assert.NotNil(t, ref.run, "should have filled a run with details")

assert.Equal(t, len(ref.run.Results), 8, "example report should have 8 calls to vulnerabilities")
assert.Equal(t, len(ref.run.Tool.Driver.Rules), 8, "example report should have 8 vulnerabilities")
assert.Equal(t, len(ref.run.Results), 24, "example report should have 24 calls to vulnerabilities")
assert.Equal(t, len(ref.run.Tool.Driver.Rules), 9, "example report should have 9 vulnerabilities")
assert.Equal(t, len(ref.report.Runs), 0, "should have not yet added the run to the report")
})

t.Run("Should create a empty report if nothing was found", func(t *testing.T) {
target := NewSarifReporter(zerolog.Nop(), "/workspaces/govulncheck-action")
ref := target.(*SarifReporter)

_ = target.Convert([]types.Finding{})
_ = target.Convert(&types.Report{Vulnerabilities: []types.Entry{}, Findings: []types.Finding{}})

assert.NotNil(t, ref.report, "should have create an empty report")
assert.NotNil(t, ref.run, "should have filled a run with details")
Expand Down

0 comments on commit 10644b6

Please sign in to comment.