software tests
This commit is contained in:
parent
d6b1b90034
commit
6c94a8653f
4 changed files with 38 additions and 8 deletions
|
|
@ -1,7 +1,37 @@
|
|||
package software_test
|
||||
|
||||
import "testing"
|
||||
import (
|
||||
"errors"
|
||||
"testing"
|
||||
|
||||
"github.com/amidaware/rmmagent/agent/software"
|
||||
)
|
||||
|
||||
func TestGetInstalledSoftware(t *testing.T) {
|
||||
testTable := []struct {
|
||||
name string
|
||||
expected []software.Software
|
||||
atLeast int
|
||||
expectedError error
|
||||
}{
|
||||
{
|
||||
name: "Get Installed Software",
|
||||
expected: []software.Software{},
|
||||
atLeast: 1,
|
||||
expectedError: nil,
|
||||
},
|
||||
}
|
||||
|
||||
for _, tt := range testTable {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
result, err := software.GetInstalledSoftware()
|
||||
if len(result) < tt.atLeast {
|
||||
t.Errorf("expected at least %d, got %d", tt.atLeast, len(result))
|
||||
}
|
||||
|
||||
if !errors.Is(tt.expectedError, err) {
|
||||
t.Errorf("expected (%v), got (%v)", tt.expectedError, err)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue