From 38f7235ad74d0b089f4d5b39857b20930d8de700 Mon Sep 17 00:00:00 2001 From: Jimmy Jia Date: Fri, 11 Nov 2016 19:47:08 -0500 Subject: [PATCH] Update dependencies and test null literals --- package.json | 19 ++++++++++--------- src/index.js | 2 +- test/index.js | 11 ++++++++--- 3 files changed, 19 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 2a5f494..5f5c85d 100644 --- a/package.json +++ b/package.json @@ -27,19 +27,20 @@ }, "homepage": "https://github.com/taion/graphql-type-json#readme", "peerDependencies": { - "graphql": "^0.4.0 || ^0.5.0 || ^0.6.0 || ^0.7.0 || ^0.8.0" + "graphql": ">=0.4.0" }, "devDependencies": { - "babel-cli": "^6.14.0", + "babel-cli": "^6.18.0", + "babel-eslint": "^7.1.0", "babel-plugin-add-module-exports": "^0.2.1", - "babel-preset-es2015": "^6.14.0", - "babel-register": "^6.14.0", + "babel-preset-es2015": "^6.18.0", + "babel-register": "^6.18.0", "chai": "^3.5.0", - "eslint": "^3.4.0", - "eslint-config-airbnb-base": "^5.0.3", - "eslint-plugin-import": "^1.14.0", - "graphql": "^0.8.0", - "mocha": "^3.0.2", + "eslint": "^3.10.0", + "eslint-config-4catalyzer": "^0.1.3", + "eslint-plugin-import": "^1.16.0", + "graphql": "^0.8.1", + "mocha": "^3.1.2", "rimraf": "^2.5.4" } } diff --git a/src/index.js b/src/index.js index dae3fc1..c878397 100644 --- a/src/index.js +++ b/src/index.js @@ -15,7 +15,7 @@ function parseLiteral(ast) { return parseFloat(ast.value); case Kind.OBJECT: { const value = Object.create(null); - ast.fields.forEach(field => { + ast.fields.forEach((field) => { value[field.name.value] = parseLiteral(field.value); }); diff --git a/test/index.js b/test/index.js index c449d27..32a3301 100644 --- a/test/index.js +++ b/test/index.js @@ -57,7 +57,7 @@ describe('GraphQLJSON', () => { }); describe('parseValue', () => { - it('should support parsing values', done => { + it('should support parsing values', (done) => { graphql( schema, 'query ($arg: JSON) { value(arg: $arg) }', @@ -72,8 +72,7 @@ describe('GraphQLJSON', () => { }); describe('parseLiteral', () => { - it('should support parsing literals', done => { - // Null values are not supported in GraphQL literals. + it('should support parsing literals', (done) => { graphql(schema, ` { value(arg: { @@ -82,12 +81,14 @@ describe('GraphQLJSON', () => { float: 3.14, true: true, false: false, + null: null, object: { string: "string", int: 3, float: 3.14, true: true, false: false, + null: null, }, array: [ "string", @@ -95,6 +96,7 @@ describe('GraphQLJSON', () => { 3.14, true, false, + null, ], }), } @@ -105,12 +107,14 @@ describe('GraphQLJSON', () => { float: 3.14, true: true, false: false, + null: null, object: { string: 'string', int: 3, float: 3.14, true: true, false: false, + null: null, }, array: [ 'string', @@ -118,6 +122,7 @@ describe('GraphQLJSON', () => { 3.14, true, false, + null, ], }); done();