Skip to content

Commit

Permalink
assert that output SPDX is valid SPDX
Browse files Browse the repository at this point in the history
  • Loading branch information
Frankie Gallina-Jones authored and ForestEckhardt committed Aug 4, 2022
1 parent 1434903 commit 341fa34
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions sbom/formatted_reader_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,9 @@ func testFormattedReader(t *testing.T, context spec.G, it spec.S) {
_, err := io.Copy(buffer, sbom.NewFormattedReader(bom, sbom.SPDXFormat))
Expect(err).NotTo(HaveOccurred())

format := syft.IdentifyFormat(buffer.Bytes())
Expect(format.ID()).To(Equal(syft.SPDXJSONFormatID))

var spdxOutput spdxOutput

err = json.Unmarshal(buffer.Bytes(), &spdxOutput)
Expand Down Expand Up @@ -153,6 +156,9 @@ func testFormattedReader(t *testing.T, context spec.G, it spec.S) {
err = json.Unmarshal(buffer.Bytes(), &spdxOutput)
Expect(err).NotTo(HaveOccurred(), buffer.String())

format := syft.IdentifyFormat(buffer.Bytes())
Expect(format.ID()).To(Equal(syft.SPDXJSONFormatID))

Expect(spdxOutput.SPDXVersion).To(Equal("SPDX-2.2"), buffer.String())

Expect(spdxOutput.Packages[0].Name).To(Equal("collapse-white-space"), buffer.String())
Expand Down

0 comments on commit 341fa34

Please sign in to comment.