-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix unit tests for enable_rewrite_for_single_file
- Loading branch information
Haily Nguyen
committed
Sep 4, 2024
1 parent
814f7c7
commit d7ffe0c
Showing
7 changed files
with
164 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
plugin/resolvergen/testdata/singlefile_enable_rewrite/gqlgen.yml
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
schema: | ||
- "testdata/schema.graphql" | ||
|
||
exec: | ||
filename: testdata/singlefile_enable_rewrite/out/ignored.go | ||
model: | ||
filename: testdata/singlefile_enable_rewrite/out/generated.go | ||
resolver: | ||
filename: testdata/singlefile_enable_rewrite/out/resolver.go | ||
type: CustomResolverType | ||
enable_rewrite_for_single_file: true | ||
|
||
models: | ||
Resolver: | ||
model: github.com/99designs/gqlgen/plugin/resolvergen/testdata/singlefile_enable_rewrite/out.Resolver | ||
|
||
omit_gqlgen_version_in_file_notice: true |
13 changes: 13 additions & 0 deletions
13
plugin/resolvergen/testdata/singlefile_enable_rewrite/out/model.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
package customresolver | ||
|
||
import "context" | ||
|
||
type Resolver struct{} | ||
|
||
type QueryResolver interface { | ||
Resolver(ctx context.Context) (*Resolver, error) | ||
} | ||
|
||
type ResolverResolver interface { | ||
Name(ctx context.Context, obj *Resolver) (string, error) | ||
} |
39 changes: 39 additions & 0 deletions
39
plugin/resolvergen/testdata/singlefile_enable_rewrite/out/resolver.go
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
package customresolver | ||
|
||
// THIS CODE WILL BE UPDATED WITH SCHEMA CHANGES. PREVIOUS IMPLEMENTATION FOR SCHEMA CHANGES WILL BE KEPT IN THE COMMENT SECTION. IMPLEMENTATION FOR UNCHANGED SCHEMA WILL BE KEPT. | ||
|
||
import ( | ||
"context" | ||
"fmt" | ||
) | ||
|
||
type CustomResolverType struct{} | ||
|
||
// Resolver is the resolver for the resolver field. | ||
func (r *queryCustomResolverType) Resolver(ctx context.Context) (*Resolver, error) { | ||
panic(fmt.Errorf("not implemented: Resolver - resolver")) | ||
} | ||
|
||
// Name is the resolver for the name field. | ||
func (r *resolverCustomResolverType) Name(ctx context.Context, obj *Resolver) (string, error) { | ||
panic(fmt.Errorf("not implemented: Name - name")) | ||
} | ||
|
||
// Query returns QueryResolver implementation. | ||
func (r *CustomResolverType) Query() QueryResolver { return &queryCustomResolverType{r} } | ||
|
||
// Resolver returns ResolverResolver implementation. | ||
func (r *CustomResolverType) Resolver() ResolverResolver { return &resolverCustomResolverType{r} } | ||
|
||
type queryCustomResolverType struct{ *CustomResolverType } | ||
type resolverCustomResolverType struct{ *CustomResolverType } | ||
|
||
// !!! WARNING !!! | ||
// The code below was going to be deleted when updating resolvers. It has been copied here so you have | ||
// one last chance to move it out of harms way if you want. There are two reasons this happens: | ||
// - When renaming or deleting a resolver the old code will be put in here. You can safely delete | ||
// it when you're done. | ||
// - You have helper methods in this file. Move them out to keep these resolver files clean. | ||
/* | ||
type CustomResolverType struct{} | ||
*/ |