From 073f27f7205e6eb4ae0c8ec6cef0472fb9c4864e Mon Sep 17 00:00:00 2001 From: jonathan schatz Date: Mon, 17 Apr 2017 02:00:43 -0700 Subject: [PATCH] apollo-server -> graphql-server upgrade, node-uuid -> uuid, supertest=2 -> supertest-3 (#39) --- lib/middleware/graphiql.js | 2 +- lib/middleware/graphql.js | 4 ++-- lib/store.js | 4 ++-- package.json | 12 ++++++------ test/integration.spec.js | 37 ++++++++++++++++++------------------- 5 files changed, 29 insertions(+), 30 deletions(-) diff --git a/lib/middleware/graphiql.js b/lib/middleware/graphiql.js index 1d0b714..30fb4ef 100644 --- a/lib/middleware/graphiql.js +++ b/lib/middleware/graphiql.js @@ -1,4 +1,4 @@ -var graphiqlExpress = require('apollo-server').graphiqlExpress; +var graphiqlExpress = require('graphql-server-express').graphiqlExpress; module.exports = graphiqlExpress({ endpointURL: '/graphql', diff --git a/lib/middleware/graphql.js b/lib/middleware/graphql.js index 64bfaf9..8f3ee08 100644 --- a/lib/middleware/graphql.js +++ b/lib/middleware/graphql.js @@ -1,8 +1,8 @@ -var apolloExpress = require('apollo-server').apolloExpress; +var graphqlExpress = require('graphql-server-express').graphqlExpress; var schema = require('../api/schema'); module.exports = function (store) { - return apolloExpress(function() { + return graphqlExpress(function() { return { schema: schema, context: { diff --git a/lib/store.js b/lib/store.js index e052469..689a761 100644 --- a/lib/store.js +++ b/lib/store.js @@ -1,8 +1,8 @@ -var uuid = require('node-uuid'); +var uuid = require('uuid'); var pick = require('lodash/pick'); var connector = require('./db/connector'); -var reports = 'remotedev_reports'; +var reports = 'remotedev_reports'; // var payloads = 'remotedev_payloads'; var knex; diff --git a/package.json b/package.json index feaffd9..e0b3d4c 100644 --- a/package.json +++ b/package.json @@ -36,29 +36,29 @@ }, "homepage": "https://github.com/zalmoxisus/remotedev-server", "dependencies": { - "apollo-server": "^0.3.3", "body-parser": "^1.15.0", "chalk": "^1.1.3", "cors": "^2.7.1", "ejs": "^2.4.1", "express": "^4.13.3", "getport": "^0.1.0", - "graphql": "^0.8.0", - "graphql-tools": "^0.8.1", + "graphql": "^0.9.3", + "graphql-server-express": "^0.7.1", + "graphql-tools": "^0.11.0", "js-data": "^2.9.0", "knex": "0.11.10", "lodash": "^4.15.0", "minimist": "^1.2.0", "morgan": "^1.7.0", - "node-uuid": "^1.4.0", "semver": "^5.3.0", "socketcluster": "^5.0.4", - "sqlite3": "^3.1.8" + "sqlite3": "^3.1.8", + "uuid": "^3.0.1" }, "devDependencies": { "expect": "^1.20.2", "mocha": "^3.2.0", "socketcluster-client": "^5.1.1", - "supertest": "^2.0.1" + "supertest": "^3.0.0" } } diff --git a/test/integration.spec.js b/test/integration.spec.js index 3703ede..f422c7e 100644 --- a/test/integration.spec.js +++ b/test/integration.spec.js @@ -19,15 +19,14 @@ describe('Server', function() { }); describe('Express backend', function() { - it('loads main page', function(done) { + it('loads main page', function() { request('http://localhost:8000') .get('/') .expect('Content-Type', /text\/html/) .expect(200) - .expect(function(res) { + .then(function(res) { expect(res.text).toMatch(/RemoteDev<\/title>/); }) - .end(done); }); it('resolves an inexistent url', function(done) { @@ -119,20 +118,20 @@ describe('Server', function() { preloadedState: '{"todos":[{"text":"Use Redux","completed":false,"id":0}]}', userAgent: 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/55.0.2883.95 Safari/537.36' }; - it('should add a report', function(done) { + it('should add a report', function() { request('http://localhost:8000') .post('/') .send(report) .set('Accept', 'application/json') .expect('Content-Type', /application\/json/) - .expect(function(res) { + .expect(200) + .then(function(res) { id = res.body.id; expect(id).toExist(); - }) - .expect(200, done); + }); }); - it('should get the report', function(done) { + it('should get the report', function() { request('http://localhost:8000') .post('/') .send({ @@ -141,13 +140,13 @@ describe('Server', function() { }) .set('Accept', 'application/json') .expect('Content-Type', /application\/json/) - .expect(function(res) { + .expect(200) + .then(function(res) { expect(res.body).toInclude(report); - }) - .expect(200, done); + }); }); - it('should list reports', function(done) { + it('should list reports', function() { request('http://localhost:8000') .post('/') .send({ @@ -155,18 +154,18 @@ describe('Server', function() { }) .set('Accept', 'application/json') .expect('Content-Type', /application\/json/) - .expect(function(res) { + .expect(200) + .then(function(res) { expect(res.body.length).toBe(1); expect(res.body[0].id).toBe(id); expect(res.body[0].title).toBe('Test report'); expect(res.body[0].added).toExist(); - }) - .expect(200, done); + }); }); }); describe('GraphQL backend', function() { - it('should get the report', function(done) { + it('should get the report', function() { request('http://localhost:8000') .post('/graphql') .send({ @@ -174,14 +173,14 @@ describe('Server', function() { }) .set('Accept', 'application/json') .expect('Content-Type', /application\/json/) - .expect(function(res) { + .expect(200) + .then(function(res) { var reports = res.body.data.reports; expect(reports.length).toBe(1); expect(reports[0].id).toExist(); expect(reports[0].title).toBe('Test report'); expect(reports[0].type).toBe('ACTIONS'); - }) - .expect(200, done); + }); }); }); });