apollo-server -> graphql-server upgrade, node-uuid -> uuid, supertest=2 -> supertest-3 (#39)
This commit is contained in:
parent
a0bbc23ef1
commit
073f27f720
@ -1,4 +1,4 @@
|
|||||||
var graphiqlExpress = require('apollo-server').graphiqlExpress;
|
var graphiqlExpress = require('graphql-server-express').graphiqlExpress;
|
||||||
|
|
||||||
module.exports = graphiqlExpress({
|
module.exports = graphiqlExpress({
|
||||||
endpointURL: '/graphql',
|
endpointURL: '/graphql',
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
var apolloExpress = require('apollo-server').apolloExpress;
|
var graphqlExpress = require('graphql-server-express').graphqlExpress;
|
||||||
var schema = require('../api/schema');
|
var schema = require('../api/schema');
|
||||||
|
|
||||||
module.exports = function (store) {
|
module.exports = function (store) {
|
||||||
return apolloExpress(function() {
|
return graphqlExpress(function() {
|
||||||
return {
|
return {
|
||||||
schema: schema,
|
schema: schema,
|
||||||
context: {
|
context: {
|
||||||
|
@ -1,8 +1,8 @@
|
|||||||
var uuid = require('node-uuid');
|
var uuid = require('uuid');
|
||||||
var pick = require('lodash/pick');
|
var pick = require('lodash/pick');
|
||||||
var connector = require('./db/connector');
|
var connector = require('./db/connector');
|
||||||
|
|
||||||
var reports = 'remotedev_reports';
|
var reports = 'remotedev_reports';
|
||||||
// var payloads = 'remotedev_payloads';
|
// var payloads = 'remotedev_payloads';
|
||||||
var knex;
|
var knex;
|
||||||
|
|
||||||
|
12
package.json
12
package.json
@ -36,29 +36,29 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/zalmoxisus/remotedev-server",
|
"homepage": "https://github.com/zalmoxisus/remotedev-server",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"apollo-server": "^0.3.3",
|
|
||||||
"body-parser": "^1.15.0",
|
"body-parser": "^1.15.0",
|
||||||
"chalk": "^1.1.3",
|
"chalk": "^1.1.3",
|
||||||
"cors": "^2.7.1",
|
"cors": "^2.7.1",
|
||||||
"ejs": "^2.4.1",
|
"ejs": "^2.4.1",
|
||||||
"express": "^4.13.3",
|
"express": "^4.13.3",
|
||||||
"getport": "^0.1.0",
|
"getport": "^0.1.0",
|
||||||
"graphql": "^0.8.0",
|
"graphql": "^0.9.3",
|
||||||
"graphql-tools": "^0.8.1",
|
"graphql-server-express": "^0.7.1",
|
||||||
|
"graphql-tools": "^0.11.0",
|
||||||
"js-data": "^2.9.0",
|
"js-data": "^2.9.0",
|
||||||
"knex": "0.11.10",
|
"knex": "0.11.10",
|
||||||
"lodash": "^4.15.0",
|
"lodash": "^4.15.0",
|
||||||
"minimist": "^1.2.0",
|
"minimist": "^1.2.0",
|
||||||
"morgan": "^1.7.0",
|
"morgan": "^1.7.0",
|
||||||
"node-uuid": "^1.4.0",
|
|
||||||
"semver": "^5.3.0",
|
"semver": "^5.3.0",
|
||||||
"socketcluster": "^5.0.4",
|
"socketcluster": "^5.0.4",
|
||||||
"sqlite3": "^3.1.8"
|
"sqlite3": "^3.1.8",
|
||||||
|
"uuid": "^3.0.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"expect": "^1.20.2",
|
"expect": "^1.20.2",
|
||||||
"mocha": "^3.2.0",
|
"mocha": "^3.2.0",
|
||||||
"socketcluster-client": "^5.1.1",
|
"socketcluster-client": "^5.1.1",
|
||||||
"supertest": "^2.0.1"
|
"supertest": "^3.0.0"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -19,15 +19,14 @@ describe('Server', function() {
|
|||||||
});
|
});
|
||||||
|
|
||||||
describe('Express backend', function() {
|
describe('Express backend', function() {
|
||||||
it('loads main page', function(done) {
|
it('loads main page', function() {
|
||||||
request('http://localhost:8000')
|
request('http://localhost:8000')
|
||||||
.get('/')
|
.get('/')
|
||||||
.expect('Content-Type', /text\/html/)
|
.expect('Content-Type', /text\/html/)
|
||||||
.expect(200)
|
.expect(200)
|
||||||
.expect(function(res) {
|
.then(function(res) {
|
||||||
expect(res.text).toMatch(/<title>RemoteDev<\/title>/);
|
expect(res.text).toMatch(/<title>RemoteDev<\/title>/);
|
||||||
})
|
})
|
||||||
.end(done);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('resolves an inexistent url', function(done) {
|
it('resolves an inexistent url', function(done) {
|
||||||
@ -119,20 +118,20 @@ describe('Server', function() {
|
|||||||
preloadedState: '{"todos":[{"text":"Use Redux","completed":false,"id":0}]}',
|
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'
|
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')
|
request('http://localhost:8000')
|
||||||
.post('/')
|
.post('/')
|
||||||
.send(report)
|
.send(report)
|
||||||
.set('Accept', 'application/json')
|
.set('Accept', 'application/json')
|
||||||
.expect('Content-Type', /application\/json/)
|
.expect('Content-Type', /application\/json/)
|
||||||
.expect(function(res) {
|
.expect(200)
|
||||||
|
.then(function(res) {
|
||||||
id = res.body.id;
|
id = res.body.id;
|
||||||
expect(id).toExist();
|
expect(id).toExist();
|
||||||
})
|
});
|
||||||
.expect(200, done);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should get the report', function(done) {
|
it('should get the report', function() {
|
||||||
request('http://localhost:8000')
|
request('http://localhost:8000')
|
||||||
.post('/')
|
.post('/')
|
||||||
.send({
|
.send({
|
||||||
@ -141,13 +140,13 @@ describe('Server', function() {
|
|||||||
})
|
})
|
||||||
.set('Accept', 'application/json')
|
.set('Accept', 'application/json')
|
||||||
.expect('Content-Type', /application\/json/)
|
.expect('Content-Type', /application\/json/)
|
||||||
.expect(function(res) {
|
.expect(200)
|
||||||
|
.then(function(res) {
|
||||||
expect(res.body).toInclude(report);
|
expect(res.body).toInclude(report);
|
||||||
})
|
});
|
||||||
.expect(200, done);
|
|
||||||
});
|
});
|
||||||
|
|
||||||
it('should list reports', function(done) {
|
it('should list reports', function() {
|
||||||
request('http://localhost:8000')
|
request('http://localhost:8000')
|
||||||
.post('/')
|
.post('/')
|
||||||
.send({
|
.send({
|
||||||
@ -155,18 +154,18 @@ describe('Server', function() {
|
|||||||
})
|
})
|
||||||
.set('Accept', 'application/json')
|
.set('Accept', 'application/json')
|
||||||
.expect('Content-Type', /application\/json/)
|
.expect('Content-Type', /application\/json/)
|
||||||
.expect(function(res) {
|
.expect(200)
|
||||||
|
.then(function(res) {
|
||||||
expect(res.body.length).toBe(1);
|
expect(res.body.length).toBe(1);
|
||||||
expect(res.body[0].id).toBe(id);
|
expect(res.body[0].id).toBe(id);
|
||||||
expect(res.body[0].title).toBe('Test report');
|
expect(res.body[0].title).toBe('Test report');
|
||||||
expect(res.body[0].added).toExist();
|
expect(res.body[0].added).toExist();
|
||||||
})
|
});
|
||||||
.expect(200, done);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
describe('GraphQL backend', function() {
|
describe('GraphQL backend', function() {
|
||||||
it('should get the report', function(done) {
|
it('should get the report', function() {
|
||||||
request('http://localhost:8000')
|
request('http://localhost:8000')
|
||||||
.post('/graphql')
|
.post('/graphql')
|
||||||
.send({
|
.send({
|
||||||
@ -174,14 +173,14 @@ describe('Server', function() {
|
|||||||
})
|
})
|
||||||
.set('Accept', 'application/json')
|
.set('Accept', 'application/json')
|
||||||
.expect('Content-Type', /application\/json/)
|
.expect('Content-Type', /application\/json/)
|
||||||
.expect(function(res) {
|
.expect(200)
|
||||||
|
.then(function(res) {
|
||||||
var reports = res.body.data.reports;
|
var reports = res.body.data.reports;
|
||||||
expect(reports.length).toBe(1);
|
expect(reports.length).toBe(1);
|
||||||
expect(reports[0].id).toExist();
|
expect(reports[0].id).toExist();
|
||||||
expect(reports[0].title).toBe('Test report');
|
expect(reports[0].title).toBe('Test report');
|
||||||
expect(reports[0].type).toBe('ACTIONS');
|
expect(reports[0].type).toBe('ACTIONS');
|
||||||
})
|
});
|
||||||
.expect(200, done);
|
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
x
Reference in New Issue
Block a user