Skip to content

Commit

Permalink
Add snapshot tests for create-types, remove stray console.logs
Browse files Browse the repository at this point in the history
  • Loading branch information
mxstbr committed Apr 21, 2020
1 parent 2e03013 commit 2c4d072
Show file tree
Hide file tree
Showing 2 changed files with 276 additions and 3 deletions.
2 changes: 0 additions & 2 deletions packages/gatsby-recipes/src/create-types.js
Original file line number Diff line number Diff line change
Expand Up @@ -140,8 +140,6 @@ module.exports = () => {
return acc
}, {})

console.log(mutationTypes)

return {
queryTypes,
mutationTypes,
Expand Down
277 changes: 276 additions & 1 deletion packages/gatsby-recipes/src/create-types.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,280 @@ const createTypes = require(`./create-types`)

test(`create-types`, () => {
const result = createTypes()
expect(result).toBeTruthy()
expect(result.mutationTypes).toMatchInlineSnapshot(`
Object {
"createFile": Object {
"args": Object {
"file": Object {
"type": "FileInput",
},
},
"resolve": [Function],
"type": "File",
},
"createGatsbyPlugin": Object {
"args": Object {
"gatsbyPlugin": Object {
"type": "GatsbyPluginInput",
},
},
"resolve": [Function],
"type": "GatsbyPlugin",
},
"createGatsbyShadowFile": Object {
"args": Object {
"gatsbyShadowFile": Object {
"type": "GatsbyShadowFileInput",
},
},
"resolve": [Function],
"type": "GatsbyShadowFile",
},
"createGitIgnore": Object {
"args": Object {
"gitIgnore": Object {
"type": "GitIgnoreInput",
},
},
"resolve": [Function],
"type": "GitIgnore",
},
"createNpmPackage": Object {
"args": Object {
"npmPackage": Object {
"type": "NPMPackageInput",
},
},
"resolve": [Function],
"type": "NPMPackage",
},
"createNpmPackageJson": Object {
"args": Object {
"npmPackageJson": Object {
"type": "NPMPackageJsonInput",
},
},
"resolve": [Function],
"type": "NPMPackageJson",
},
"createNpmScript": Object {
"args": Object {
"npmScript": Object {
"type": "NPMScriptInput",
},
},
"resolve": [Function],
"type": "NPMScript",
},
"destroyFile": Object {
"args": Object {
"file": Object {
"type": "FileInput",
},
},
"resolve": [Function],
"type": "File",
},
"destroyGatsbyPlugin": Object {
"args": Object {
"gatsbyPlugin": Object {
"type": "GatsbyPluginInput",
},
},
"resolve": [Function],
"type": "GatsbyPlugin",
},
"destroyGatsbyShadowFile": Object {
"args": Object {
"gatsbyShadowFile": Object {
"type": "GatsbyShadowFileInput",
},
},
"resolve": [Function],
"type": "GatsbyShadowFile",
},
"destroyGitIgnore": Object {
"args": Object {
"gitIgnore": Object {
"type": "GitIgnoreInput",
},
},
"resolve": [Function],
"type": "GitIgnore",
},
"destroyNpmPackage": Object {
"args": Object {
"npmPackage": Object {
"type": "NPMPackageInput",
},
},
"resolve": [Function],
"type": "NPMPackage",
},
"destroyNpmPackageJson": Object {
"args": Object {
"npmPackageJson": Object {
"type": "NPMPackageJsonInput",
},
},
"resolve": [Function],
"type": "NPMPackageJson",
},
"destroyNpmScript": Object {
"args": Object {
"npmScript": Object {
"type": "NPMScriptInput",
},
},
"resolve": [Function],
"type": "NPMScript",
},
"updateFile": Object {
"args": Object {
"file": Object {
"type": "FileInput",
},
},
"resolve": [Function],
"type": "File",
},
"updateGatsbyPlugin": Object {
"args": Object {
"gatsbyPlugin": Object {
"type": "GatsbyPluginInput",
},
},
"resolve": [Function],
"type": "GatsbyPlugin",
},
"updateGatsbyShadowFile": Object {
"args": Object {
"gatsbyShadowFile": Object {
"type": "GatsbyShadowFileInput",
},
},
"resolve": [Function],
"type": "GatsbyShadowFile",
},
"updateGitIgnore": Object {
"args": Object {
"gitIgnore": Object {
"type": "GitIgnoreInput",
},
},
"resolve": [Function],
"type": "GitIgnore",
},
"updateNpmPackage": Object {
"args": Object {
"npmPackage": Object {
"type": "NPMPackageInput",
},
},
"resolve": [Function],
"type": "NPMPackage",
},
"updateNpmPackageJson": Object {
"args": Object {
"npmPackageJson": Object {
"type": "NPMPackageJsonInput",
},
},
"resolve": [Function],
"type": "NPMPackageJson",
},
"updateNpmScript": Object {
"args": Object {
"npmScript": Object {
"type": "NPMScriptInput",
},
},
"resolve": [Function],
"type": "NPMScript",
},
}
`)
expect(result.queryTypes).toMatchInlineSnapshot(`
Object {
"allGatsbyPlugin": Object {
"resolve": [Function],
"type": "GatsbyPluginConnection",
},
"allGitIgnore": Object {
"resolve": [Function],
"type": "GitIgnoreConnection",
},
"allNPMPackageJson": Object {
"resolve": [Function],
"type": "NPMPackageJsonConnection",
},
"allNPMScript": Object {
"resolve": [Function],
"type": "NPMScriptConnection",
},
"file": Object {
"args": Object {
"id": Object {
"type": "String",
},
},
"resolve": [Function],
"type": "File",
},
"gatsbyPlugin": Object {
"args": Object {
"id": Object {
"type": "String",
},
},
"resolve": [Function],
"type": "GatsbyPlugin",
},
"gatsbyShadowFile": Object {
"args": Object {
"id": Object {
"type": "String",
},
},
"resolve": [Function],
"type": "GatsbyShadowFile",
},
"gitIgnore": Object {
"args": Object {
"id": Object {
"type": "String",
},
},
"resolve": [Function],
"type": "GitIgnore",
},
"npmPackage": Object {
"args": Object {
"id": Object {
"type": "String",
},
},
"resolve": [Function],
"type": "NPMPackage",
},
"npmPackageJson": Object {
"args": Object {
"id": Object {
"type": "String",
},
},
"resolve": [Function],
"type": "NPMPackageJson",
},
"npmScript": Object {
"args": Object {
"id": Object {
"type": "String",
},
},
"resolve": [Function],
"type": "NPMScript",
},
}
`)
})

0 comments on commit 2c4d072

Please sign in to comment.