docsonnet/pkg/render/render_test.go
Jeroen Op 't Eynde 1f8d4c6fbf
feat: containerize (#19)
* feat: containerize

* Stripping reduces binary size, fully static linking makes the binary more portable

Co-authored-by: sh0rez <me@shorez.de>
2021-06-03 14:58:12 +02:00

48 lines
645 B
Go

package render
import (
"testing"
"github.com/jsonnet-libs/docsonnet/pkg/docsonnet"
"github.com/stretchr/testify/assert"
)
func TestSortFields(t *testing.T) {
api := docsonnet.Fields{
"new": dfn(),
"newNamed": dfn(),
"aaa": dfn(),
"bbb": dobj(),
"ccc": dfn(),
"metadata": dobj(),
}
sorted := []string{
"new",
"newNamed",
"aaa",
"ccc",
"bbb",
"metadata",
}
res := sortFields(api)
assert.Equal(t, sorted, res)
}
func dobj() docsonnet.Field {
return docsonnet.Field{
Object: &docsonnet.Object{},
}
}
func dfn() docsonnet.Field {
return docsonnet.Field{
Function: &docsonnet.Function{},
}
}