File tree Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Expand file tree Collapse file tree 1 file changed +16
-1
lines changed Original file line number Diff line number Diff line change 11package docval_test
22
33import (
4+ "os"
5+ "path/filepath"
6+ "runtime"
47 "testing"
58
69 "github.com/stackql/any-sdk/pkg/docval"
710)
811
912var (
10- validator docval.FileValidator = docval . NewFileValidator ( "testdata/schema-definitions" )
13+ validator docval.FileValidator
1114)
1215
16+ func init () {
17+ // Normalize CWD so all relative testdata paths work
18+ _ , thisFile , _ , _ := runtime .Caller (0 )
19+ pkgDir := filepath .Dir (thisFile )
20+ if err := os .Chdir (pkgDir ); err != nil {
21+ panic (err )
22+ }
23+
24+ // Initialize validator once
25+ validator = docval .NewFileValidator (filepath .Join ("testdata" , "schema-definitions" ))
26+ }
27+
1328func TestValidateAndParse_ValidJSON (t * testing.T ) {
1429 jsonDoc := []byte (`{"name": "Alice", "age": 30}` )
1530 jsonSchema := []byte (`{
You can’t perform that action at this time.
0 commit comments