syft/syft/source/scope_test.go
Alex Goodman 4d0da703bf
normalize enums to lowercase with hyphens (#2363)
Signed-off-by: Alex Goodman <wagoodman@users.noreply.github.com>
2023-11-28 11:02:20 -05:00

58 lines
817 B
Go

package source
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestParseScope(t *testing.T) {
tests := []struct {
name string
want Scope
}{
// go cases
{
name: "squashed",
want: SquashedScope,
},
{
name: "all-layers",
want: AllLayersScope,
},
// fall back to unknown
{
name: "make-believe",
want: UnknownScope,
},
{
name: "",
want: UnknownScope,
},
{
name: " ",
want: UnknownScope,
},
// to support the original value
{
name: "Squashed",
want: SquashedScope,
},
{
name: "AllLayers",
want: AllLayersScope,
},
// case insensitive
{
name: "alLlaYerS",
want: AllLayersScope,
},
}
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
assert.Equal(t, tt.want, ParseScope(tt.name))
})
}
}