-
Notifications
You must be signed in to change notification settings - Fork 139
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* make scaffold test to work in strict mode by default * feat: move boiler code uot for typeTypeResolvers specs * eslint fixes * feat: move boiler code out for mutation specs * feat: move boiler code out for query specs Co-authored-by: Jan Michael VIncent Trinidad <janmvtrinidad@gmail.com>
- Loading branch information
1 parent
2fdfdad
commit f023cdf
Showing
12 changed files
with
363 additions
and
77 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
module.exports = { | ||
trailingComma: "all", | ||
singleQuote: true, | ||
printWidth: 120, | ||
tabWidth: 2 | ||
}; |
Large diffs are not rendered by default.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,16 @@ | ||
import td from "testdouble"; | ||
import { GqlContext, {{#if hasArguments}}Mutation{{toUpperCase mutationName}}Args{{/if}} } from "{{generatedPrefix}}/graphql/types"; | ||
import { {{mutationName}}Mutation } from "./{{mutationName}}Mutation"; | ||
|
||
const test{{mutationName}} = ({{#if hasArguments}}variables: Mutation{{toUpperCase mutationName}}Args, {{/if}}context: GqlContext) => {{mutationName}}Mutation({}, {{#if hasArguments}}variables{{else}} {} {{/if}}, context, null) | ||
import { GqlContext, {{#if hasArguments}}Mutation{{toUpperCase mutationName}}Args,{{/if}} test{{toUpperCase mutationName}} } from "{{generatedPrefix}}/graphql/helpers/{{mutationName}}MutationSpecWrapper" | ||
|
||
|
||
test("{{mutationName}}", async () => { | ||
|
||
const context = td.object<GqlContext>(); | ||
|
||
// td.when(context.{{moduleName}}Repository.findOne()).thenResolve() | ||
|
||
{{#if hasArguments}} | ||
const variables: Mutation{{toUpperCase mutationName}}Args = {} | ||
{{/if}} | ||
|
||
const result = await test{{mutationName}}({{#if hasArguments}}variables,{{/if}} context); | ||
const result = await test{{toUpperCase mutationName}}({{#if hasArguments}}variables,{{/if}} context); | ||
|
||
}); |
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,7 @@ | ||
import { GraphQLResolveInfo } from 'graphql' | ||
import { GqlContext, {{#if hasArguments}}Mutation{{toUpperCase mutationName}}Args{{/if}} } from "{{generatedPrefix}}/graphql/types"; | ||
import { {{mutationName}}Mutation } from "{{appPrefix}}/{{graphqlFileRootPath}}mutations/{{mutationName}}Mutation"; | ||
|
||
export const test{{toUpperCase mutationName}} = ({{#if hasArguments}}variables: Mutation{{toUpperCase mutationName}}Args, {{/if}}context: GqlContext) => {{mutationName}}Mutation?.({}, {{#if hasArguments}}variables{{else}} {} {{/if}}, context, {} as GraphQLResolveInfo) | ||
|
||
export type {GqlContext, {{#if hasArguments}}Mutation{{toUpperCase mutationName}}Args{{/if}} } |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { GraphQLResolveInfo } from 'graphql' | ||
import { GqlContext, {{#if hasArguments}}Query{{toUpperCase queryName}}Args{{/if}} } from "{{generatedPrefix}}/graphql/types"; | ||
import { {{queryName}}Query } from "{{appPrefix}}/{{graphqlFileRootPath}}queries/{{queryName}}Query"; | ||
|
||
|
||
export const test{{toUpperCase queryName}} = ({{#if hasArguments}}variables: Query{{toUpperCase queryName}}Args,{{/if}} context: GqlContext) => {{queryName}}Query?.({}, {{#if hasArguments}}variables{{else}} {} {{/if}}, context, {} as GraphQLResolveInfo) | ||
|
||
|
||
export type {GqlContext, {{#if hasArguments}}Query{{toUpperCase queryName}}Args{{/if}} } |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { GraphQLResolveInfo } from 'graphql' | ||
import type { GqlContext, ResolversParentTypes, {{#if hasArguments}}{{typeName}}{{capitalizedFieldName}}Args{{/if}} } from "{{generatedPrefix}}/graphql/types"; | ||
import { {{typeName}}{{capitalizedFieldName}} } from "{{appPrefix}}/{{graphqlFileRootPath}}types/{{typeName}}{{capitalizedFieldName}}"; | ||
|
||
{{#if resolveReferenceType}}type ParentType = Parameters<typeof {{typeName}}{{capitalizedFieldName}}>[0];{{/if}} | ||
|
||
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} |