Skip to content

Commit

Permalink
marshal test
Browse files Browse the repository at this point in the history
  • Loading branch information
ysebyy committed Aug 21, 2024
1 parent fde8cd6 commit f7b956f
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions pkg/dtrack/payloads_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ func TestMarshal(t *testing.T) {
testProjectTag = "some-random-project-tag"
testProjectCodeOwner = "some-random-code-owner"
testClassifier = "some-random-classifier"
sbomsB64 = "ewogICJib21Gb3JtYXQiOiAiIiwKICAic3BlY1ZlcnNpb24iOiAiIiwKICAidmVyc2lvbiI6IDAKfQo="
sbomsB64 = "ewogICJib21Gb3JtYXQiOiAiQ3ljbG9uZURYIiwKICAic3BlY1ZlcnNpb24iOiAiMS40IiwKICAidmVyc2lvbiI6IDEKfQo="
)

t.Run("marshal createProjectPayload instances correctly", func(t *testing.T) {
Expand Down Expand Up @@ -58,8 +58,14 @@ func TestMarshal(t *testing.T) {
})

t.Run("marshal updateSBOMsPayload instances correctly", func(t *testing.T) {
bom := &cdx.BOM{ // Address the error in the new() call.
BOMFormat: "CycloneDX",
Version: 1,
SpecVersion: cdx.SpecVersion(5),
}

got, err := json.Marshal(updateSBOMsPayload{
Sboms: new(cdx.BOM), // zeroed mem value - b64 is always the same
Sboms: bom, // zeroed mem value - b64 is always the same
ProjectName: testProjectName,
Tags: []string{testProjectTag},
})
Expand Down

0 comments on commit f7b956f

Please sign in to comment.