-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: David Wertenteil <[email protected]>
- Loading branch information
David Wertenteil
committed
Apr 10, 2024
1 parent
d0ee88d
commit 1a921cf
Showing
3 changed files
with
43 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package softwarecomposition | ||
|
||
import ( | ||
"testing" | ||
|
||
_ "embed" | ||
|
||
"github.com/stretchr/testify/assert" | ||
) | ||
|
||
//go:embed testdata/artifact.json | ||
Check failure on line 11 in pkg/apis/softwarecomposition/syfttypes_test.go
|
||
var artifact []byte | ||
|
||
func TestUpdateSBOMSyft(t *testing.T) { | ||
type args struct { | ||
id string | ||
metadataType string | ||
} | ||
tests := []struct { | ||
name string | ||
input []byte | ||
args args | ||
wantErr bool | ||
}{ | ||
{ | ||
name: "TestUpdateSBOMSyft", | ||
input: artifact, | ||
args: args{id: "8a49897e59f569c2", metadataType: "dpkg-db-entry"}, | ||
wantErr: false, | ||
}, | ||
} | ||
for _, tt := range tests { | ||
t.Run(tt.name, func(t *testing.T) { | ||
c := SyftPackage{} | ||
err := c.UnmarshalJSON(tt.input) | ||
assert.NoError(t, err) | ||
assert.Equal(t, c.ID, tt.args.id) | ||
assert.Equal(t, c.MetadataType, tt.args.metadataType) | ||
}) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters