github.com/woocoos/entco@v0.0.0-20240411071658-1e7b23d4df15/genx/gql/resolver_test.go (about) 1 package gql 2 3 import ( 4 "github.com/99designs/gqlgen/api" 5 "github.com/99designs/gqlgen/codegen/config" 6 "github.com/stretchr/testify/suite" 7 "github.com/woocoos/entco/test" 8 "os" 9 "path/filepath" 10 "testing" 11 ) 12 13 type gqlgenSuite struct { 14 suite.Suite 15 GqlConfig *config.Config 16 } 17 18 // set up 19 func (s *gqlgenSuite) SetupSuite() { 20 } 21 22 func TestGqlgen(t *testing.T) { 23 suite.Run(t, new(gqlgenSuite)) 24 } 25 26 func (s *gqlgenSuite) TestImplement() { 27 gqlfile := filepath.Join(test.Path("../"), "./integration/gentest/testdata/resolver.yml") 28 testdir := filepath.Dir(gqlfile) 29 err := os.RemoveAll(filepath.Join(testdir, "tmp")) 30 s.Require().NoError(os.Chdir(testdir)) 31 cfg, err := config.LoadConfig(gqlfile) 32 s.Require().NoError(err) 33 err = api.Generate(cfg, api.AddPlugin(NewResolverPlugin(WithRelayNodeEx()))) 34 s.Require().NoError(err) 35 }