github.com/lineaje-labs/syft@v0.98.1-0.20231227153149-9e393f60ff1b/syft/format/internal/cyclonedxutil/decoder_test.go (about) 1 package cyclonedxutil 2 3 import ( 4 "bytes" 5 "encoding/json" 6 "testing" 7 8 "github.com/CycloneDX/cyclonedx-go" 9 "github.com/stretchr/testify/assert" 10 ) 11 12 func Test_missingComponentsDecode(t *testing.T) { 13 bom := &cyclonedx.BOM{ 14 SpecVersion: cyclonedx.SpecVersion1_4, 15 } 16 bomBytes, _ := json.Marshal(&bom) 17 dec := NewDecoder(cyclonedx.BOMFileFormatJSON) 18 19 _, err := dec.Decode(bytes.NewReader(bomBytes)) 20 assert.NoError(t, err) 21 }