github.com/noqcks/syft@v0.0.0-20230920222752-a9e2c4e288e5/syft/formats/syftjson/format_test.go (about)

     1  package syftjson
     2  
     3  import (
     4  	"testing"
     5  
     6  	"github.com/anchore/syft/internal"
     7  )
     8  
     9  func TestFormat(t *testing.T) {
    10  	tests := []struct {
    11  		name    string
    12  		version string
    13  	}{
    14  		{
    15  			name:    "default version should use latest internal version",
    16  			version: "",
    17  		},
    18  	}
    19  
    20  	for _, c := range tests {
    21  		c := c
    22  		t.Run(c.name, func(t *testing.T) {
    23  			sbomFormat := Format()
    24  			if sbomFormat.ID() != ID {
    25  				t.Errorf("expected ID %q, got %q", ID, sbomFormat.ID())
    26  			}
    27  
    28  			if sbomFormat.Version() != internal.JSONSchemaVersion {
    29  				t.Errorf("expected version %q, got %q", c.version, sbomFormat.Version())
    30  			}
    31  		})
    32  	}
    33  }