Comparing version
{ | ||
"name": "gqb", | ||
"version": "0.1.2", | ||
"description": "graphql schema builder", | ||
"main": "lib/index.js", | ||
"repository": "https://github.com/istarkov/gqb", | ||
"author": "istarkov@gmail.com", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "yarn run lint && yarn run build:lib", | ||
"test": "jest", | ||
"lint": "eslint src", | ||
"prebuild:lib": "rm -rf lib/*", | ||
"build:lib": "babel --ignore spec.js --out-dir lib src", | ||
"prepublish": "yarn run build" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.18.0", | ||
"babel-core": "^6.21.0", | ||
"babel-eslint": "^7.1.1", | ||
"babel-jest": "^18.0.0", | ||
"babel-loader": "^6.2.10", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-plugin-external-helpers": "^6.18.0", | ||
"babel-plugin-flow-react-proptypes": "^0.18.2", | ||
"babel-plugin-transform-class-properties": "^6.19.0", | ||
"babel-plugin-transform-flow-strip-types": "^6.21.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.20.2", | ||
"babel-polyfill": "^6.22.0", | ||
"babel-preset-latest": "^6.16.0", | ||
"babel-preset-react": "^6.16.0", | ||
"eslint": "^3.12.2", | ||
"eslint-config-airbnb": "^13.0.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jsx-a11y": "^2.0.2", | ||
"eslint-plugin-react": "^6.8.0", | ||
"graphql": "^0.9.1", | ||
"graphql-tools": "^0.10.0", | ||
"jest": "^18.1.0", | ||
"rimraf": "^2.5.4" | ||
}, | ||
"dependencies": {}, | ||
"peerDependencies": { | ||
"graphql": "^0.9.1" | ||
} | ||
"name": "gqb", | ||
"version": "0.1.3", | ||
"description": "graphql schema builder", | ||
"main": "lib/index.js", | ||
"repository": "https://github.com/istarkov/gqb", | ||
"author": "istarkov@gmail.com", | ||
"license": "MIT", | ||
"scripts": { | ||
"build": "yarn run lint && yarn run build:lib", | ||
"test": "jest", | ||
"lint": "eslint src", | ||
"prebuild:lib": "rm -rf lib/*", | ||
"build:lib": "babel --ignore spec.js --out-dir lib src", | ||
"prepublish": "yarn run build" | ||
}, | ||
"devDependencies": { | ||
"babel-cli": "^6.18.0", | ||
"babel-core": "^6.21.0", | ||
"babel-eslint": "^7.1.1", | ||
"babel-jest": "^18.0.0", | ||
"babel-loader": "^6.2.10", | ||
"babel-plugin-add-module-exports": "^0.2.1", | ||
"babel-plugin-external-helpers": "^6.18.0", | ||
"babel-plugin-flow-react-proptypes": "^0.18.2", | ||
"babel-plugin-transform-class-properties": "^6.19.0", | ||
"babel-plugin-transform-flow-strip-types": "^6.21.0", | ||
"babel-plugin-transform-object-rest-spread": "^6.20.2", | ||
"babel-polyfill": "^6.22.0", | ||
"babel-preset-latest": "^6.16.0", | ||
"babel-preset-react": "^6.16.0", | ||
"eslint": "^3.12.2", | ||
"eslint-config-airbnb": "^13.0.0", | ||
"eslint-plugin-import": "^2.2.0", | ||
"eslint-plugin-jsx-a11y": "^2.0.2", | ||
"eslint-plugin-react": "^6.8.0", | ||
"graphql": "^0.9.1", | ||
"graphql-tools": "^0.10.0", | ||
"jest": "^18.1.0", | ||
"rimraf": "^2.5.4" | ||
}, | ||
"dependencies": {}, | ||
"peerDependencies": { | ||
"graphql": "^0.9.1" | ||
} | ||
} |
@@ -8,3 +8,3 @@ import { gqb, getResolvers } from '../'; | ||
type Query { | ||
hello: String${ | ||
hello: String${ // field resolver source | ||
() => 'World' | ||
@@ -18,2 +18,30 @@ }, | ||
type Mutation { | ||
setMessage(message: String): String${ // mutation source | ||
(_, { message }) => `Mutated ${message}` | ||
} | ||
} | ||
`; | ||
const executableSchema = makeExecutableSchema( | ||
getResolvers(schema) | ||
); | ||
const { data } = await graphql( | ||
executableSchema, | ||
'{ hello, pic(size: 20)}' | ||
); | ||
expect(data).toMatchSnapshot(); | ||
const { data: mutData } = await graphql( | ||
executableSchema, | ||
'mutation { setMessage(message: "Hello") }' | ||
); | ||
expect(mutData).toMatchSnapshot(); | ||
}); | ||
test('it supports schema inlining', async () => { | ||
const mutations = gqb` | ||
type Mutation { | ||
setMessage(message: String): String${ | ||
@@ -25,2 +53,18 @@ (_, { message }) => `Mutated ${message}` | ||
const queries = gqb` | ||
type Query { | ||
hello: String${ | ||
() => 'World' | ||
}, | ||
pic(size: Int): String${ | ||
(_, { size }) => `pic size is: ${size}` | ||
} | ||
} | ||
`; | ||
const schema = gqb` | ||
${queries} | ||
${mutations} | ||
`; | ||
const executableSchema = makeExecutableSchema( | ||
@@ -27,0 +71,0 @@ getResolvers(schema) |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
No README
QualityPackage does not have a README. This may indicate a failed publish or a low quality package.
Found 1 instance in 1 package
136009
1.71%211
20.57%1
-50%54
Infinity%