diff --git a/dids/didjwk/didjwk_test.go b/dids/didjwk/didjwk_test.go index aceb45b..a876f71 100644 --- a/dids/didjwk/didjwk_test.go +++ b/dids/didjwk/didjwk_test.go @@ -1,6 +1,7 @@ package didjwk_test import ( + "fmt" "testing" "github.com/alecthomas/assert/v2" @@ -40,11 +41,13 @@ func TestVector_Resolve(t *testing.T) { testVectors, err := web5go.ReadTestVector[string, didcore.ResolutionResult]("../../web5-spec/test-vectors/did_jwk/resolve.json") assert.NoError(t, err) + fmt.Println("Running test vectors: ", testVectors.Description) resolver := &didjwk.Resolver{} for _, vector := range testVectors.Vectors { t.Run(vector.Description, func(t *testing.T) { + fmt.Println("Running test vector: ", vector.Description) result, err := resolver.Resolve(vector.Input) if vector.Errors { diff --git a/web5-spec-test-vectors.go b/web5-spec-test-vectors.go index 89df3a2..f4afacd 100644 --- a/web5-spec-test-vectors.go +++ b/web5-spec-test-vectors.go @@ -5,11 +5,13 @@ import ( "os" ) +// TestVectors are JSON files which are tested against to ensure interop with the specification type TestVectors[T, U any] struct { Description string `json:"description"` Vectors []TestVector[T, U] `json:"vectors"` } +// TestVector is an individual test vector case type TestVector[T, U any] struct { Description string `json:"description"` Input T `json:"input"` @@ -17,6 +19,7 @@ type TestVector[T, U any] struct { Errors bool `json:"errors"` } +// ReadTestVector is for reading the vector at the given path func ReadTestVector[T, U any](path string) (TestVectors[T, U], error) { data, err := os.ReadFile(path) if err != nil {