Skip to content

Commit

Permalink
fix: allow for arguments in type resolvers specs (#725)
Browse files Browse the repository at this point in the history
  • Loading branch information
lgandecki authored Jan 24, 2021
1 parent 76c1490 commit 3046681
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion templates/typeTypeResolvers.spec.handlebars
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import td from "testdouble";
import { GqlContext, ResolversParentTypes, test{{typeName}}{{capitalizedFieldName}} } from "{{generatedPrefix}}/graphql/helpers/{{typeName}}{{capitalizedFieldName}}SpecWrapper"
import { GqlContext, ResolversParentTypes, test{{typeName}}{{capitalizedFieldName}} {{#if hasArguments}},{{typeName}}{{capitalizedFieldName}}Args{{/if}} } from "{{generatedPrefix}}/graphql/helpers/{{typeName}}{{capitalizedFieldName}}SpecWrapper"

test("{{typeName}}{{capitalizedFieldName}}", async () => {
const context = td.object<GqlContext>();
Expand Down
2 changes: 1 addition & 1 deletion templates/typeTypeResolversSpecWrapper.handlebars
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@ import { {{typeName}}{{capitalizedFieldName}} } from "{{appPrefix}}/{{graphqlFil

export const test{{typeName}}{{capitalizedFieldName}} = (parent: {{#if resolveReferenceType}}ParentType{{else}}ResolversParentTypes["{{typeName}}"]{{/if}}, {{#if hasArguments}}variables: {{typeName}}{{capitalizedFieldName}}Args,{{/if}} context: GqlContext) => {{typeName}}{{capitalizedFieldName}}?.({...parent, __typename: '{{typeName}}'}, {{#unless resolveReferenceType}}{{#if hasArguments}}variables{{else}} {} {{/if}},{{/unless}} context, {} as GraphQLResolveInfo)

export type {GqlContext, ResolversParentTypes}
export type {GqlContext, ResolversParentTypes {{#if hasArguments}},{{typeName}}{{capitalizedFieldName}}Args{{/if}} }

0 comments on commit 3046681

Please sign in to comment.