Skip to content

Commit

Permalink
updated test cases to resolve linting issues in them
Browse files Browse the repository at this point in the history
  • Loading branch information
kanodia-parag committed Dec 9, 2024
1 parent ab37f57 commit 2fbba69
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 6 deletions.
27 changes: 26 additions & 1 deletion .github/workflows/check-coverage
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,29 @@ go test -covermode atomic -coverprofile=/tmp/coverage.out.tmp -coverpkg=./... $(
# ignore protobuf files
cat /tmp/coverage.out.tmp | grep -v ".pb.go" > /tmp/coverage.out

goveralls -coverprofile=/tmp/coverage.out -service=github -ignore='_examples/*/*,_examples/*/*/*,integration/*,integration/*/*,codegen/testserver/*/*,plugin/resolvergen/testdata/*/*,plugin/modelgen/*/*,plugin/federation/testdata/*/*/*,*/generated.go,*/*/generated.go,*/*/*/generated.go,graphql/executable_schema_mock.go'
join () {
local IFS="$1"
shift
echo "$*"
}

ignore_list=(
'_examples/*/*'
'_examples/*/*/*'
'integration/*'
'integration/*/*'
'codegen/testserver/**/*generated*'
'codegen/testserver/**/*generated*/**'
'codegen/testserver/**/models-gen.go'
'codegen/testserver/**/resolver.go'
'plugin/resolvergen/testdata/*/*'
'plugin/modelgen/*/*'
'plugin/federation/testdata/*/*/*'
'*/generated.go'
'*/*/generated.go'
'*/*/*/generated.go'
'graphql/executable_schema_mock.go'
)
ignore=$(join , "${ignore_list[@]}")

goveralls -coverprofile=/tmp/coverage.out -service=github "-ignore=$ignore"
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"encoding/json"
"testing"

"github.com/99designs/gqlgen/graphql/handler/transport"
"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/client"
Expand All @@ -16,12 +17,13 @@ import (

func TestQuery(t *testing.T) {
resolvers := &Stub{}
srv := handler.NewDefaultServer(NewExecutableSchema(Config{
srv := handler.New(NewExecutableSchema(Config{
Resolvers: resolvers,
Directives: DirectiveRoot{
Log: LogDirective,
},
}))
srv.AddTransport(transport.POST{})
c := client.New(srv)

testAge := new(int)
Expand Down Expand Up @@ -139,12 +141,13 @@ func TestQuery(t *testing.T) {

func TestMutation(t *testing.T) {
resolvers := &Stub{}
srv := handler.NewDefaultServer(NewExecutableSchema(Config{
srv := handler.New(NewExecutableSchema(Config{
Resolvers: resolvers,
Directives: DirectiveRoot{
Log: LogDirective,
},
}))
srv.AddTransport(transport.POST{})
c := client.New(srv)

createdAt := "2021-01-01"
Expand Down Expand Up @@ -224,12 +227,13 @@ func TestMutation(t *testing.T) {

func TestSubscription(t *testing.T) {
resolvers := &Stub{}
srv := handler.NewDefaultServer(NewExecutableSchema(Config{
srv := handler.New(NewExecutableSchema(Config{
Resolvers: resolvers,
Directives: DirectiveRoot{
Log: LogDirective,
},
}))
srv.AddTransport(transport.POST{})
c := client.New(srv)

createdAt := "2021-01-01"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ package federation
import (
"testing"

"github.com/99designs/gqlgen/graphql/handler/transport"
"github.com/stretchr/testify/require"

"github.com/99designs/gqlgen/client"
Expand All @@ -13,11 +14,14 @@ import (
)

func TestFederationWithUseFunctionSyntaxForExecutionContext(t *testing.T) {
c := client.New(handler.NewDefaultServer(
srv := handler.New(
generated.NewExecutableSchema(generated.Config{
Resolvers: &usefunctionsyntaxforexecutioncontext.Resolver{},
}),
))
)
srv.AddTransport(transport.POST{})
c := client.New(srv)


t.Run("Hello entities", func(t *testing.T) {
representations := []map[string]any{
Expand Down

0 comments on commit 2fbba69

Please sign in to comment.