validate_test.go 383 Bytes
Newer Older
Eric Myhre's avatar
Eric Myhre committed
1
package schema
Eric Myhre's avatar
Eric Myhre committed
2 3 4 5 6 7 8 9 10 11 12

import (
	"testing"

	. "github.com/warpfork/go-wish"

	"github.com/ipld/go-ipld-prime/impl/free"
)

func TestSimpleTypes(t *testing.T) {
	t.Run("string alone", func(t *testing.T) {
Eric Myhre's avatar
Eric Myhre committed
13
		n1, _ := ipldfree.NodeBuilder().CreateString("asdf")
Eric Myhre's avatar
Eric Myhre committed
14
		t1 := TypeString{
15
			anyType{name: "Foo"},
Eric Myhre's avatar
Eric Myhre committed
16 17
		}
		Wish(t,
Eric Myhre's avatar
Eric Myhre committed
18
			Validate(TypeSystem{}, t1, n1),
Eric Myhre's avatar
Eric Myhre committed
19 20 21
			ShouldEqual, []error(nil))
	})
}