added tests, fixed package.json
parent
448886b33f
commit
8e530ef49c
10
package.json
10
package.json
|
@ -1,6 +1,6 @@
|
|||
{
|
||||
"name": "tracman",
|
||||
"version": "3.0.0",
|
||||
"version": "0.3.0",
|
||||
"description": "Tracks user's GPS location",
|
||||
"main": "server.js",
|
||||
"dependencies": {
|
||||
|
@ -26,10 +26,12 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"chai": "^3.5.0",
|
||||
"chai-http": "^2.0.1"
|
||||
"chai-http": "^2.0.1",
|
||||
"mocha": "^2.5.3",
|
||||
"supertest": "^1.2.0"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "test.js",
|
||||
"test": "mocha test.js",
|
||||
"start": "node server.js"
|
||||
},
|
||||
"repository": {
|
||||
|
@ -45,7 +47,7 @@
|
|||
"license": "MIT",
|
||||
"README": "README.md",
|
||||
"bugs": {
|
||||
"url": "https://tracman.org/bug"
|
||||
"url": "https://github.com/Tracman-org/Server/issues"
|
||||
},
|
||||
"homepage": "https://tracman.org/"
|
||||
}
|
||||
|
|
102
test.js
102
test.js
|
@ -1,35 +1,91 @@
|
|||
var chai = require('chai'),
|
||||
chaiHttp = require('chai-http'),
|
||||
request = require('supertest'),
|
||||
server = require('./server'),
|
||||
should = chai.should();
|
||||
chai.use(chaiHttp);
|
||||
|
||||
describe('Routes', function() {
|
||||
|
||||
describe('Index', function() {
|
||||
// var server;
|
||||
// beforeEach(function() {
|
||||
// server = require('./server');
|
||||
// });
|
||||
// afterEach(function() {
|
||||
// server.close();
|
||||
// });
|
||||
|
||||
it('Displays homepage', function(done){
|
||||
chai.request(server)
|
||||
.get('/')
|
||||
.end(function(err,res){
|
||||
res.should.have.status(200);
|
||||
done();
|
||||
});
|
||||
request(server).get('/')
|
||||
.expect(200)
|
||||
.end(function(err,res){ done(); });
|
||||
});
|
||||
|
||||
it('Displays robots.txt', function(done){
|
||||
chai.request(server)
|
||||
.get('/robots.txt')
|
||||
.end(function(err,res){
|
||||
res.should.have.status(200);
|
||||
res.should.be.text;
|
||||
done();
|
||||
});
|
||||
request(server).get('/robots.txt')
|
||||
.expect(200)
|
||||
.expect('Content-Type', /text/)
|
||||
.end(function(err,res){ done(); });
|
||||
});
|
||||
it('Displays a map', function(done){
|
||||
chai.request(server)
|
||||
.get('/map/keith')
|
||||
.end(function(err,res){
|
||||
res.should.have.status(200);
|
||||
done();
|
||||
});
|
||||
|
||||
it('Displays example map', function(done){
|
||||
request(server).get('/map/keith')
|
||||
.expect(200)
|
||||
.end(function(err,res){ done(); });
|
||||
});
|
||||
|
||||
|
||||
// it('Can\'t set location on example map', function(done){
|
||||
// //TODO: Check websocketssecurity
|
||||
// done();
|
||||
// });
|
||||
|
||||
it('Sends invite request', function(done){
|
||||
request(server).post('/')
|
||||
.send({
|
||||
"name":"Mocha Test",
|
||||
"email":"mocha@example.com",
|
||||
"why":"Because I really really want it. "
|
||||
})
|
||||
.expect(200)
|
||||
.end(function(err, res) {
|
||||
if (err){ done(err); }
|
||||
else { done(); }
|
||||
});
|
||||
});
|
||||
|
||||
});
|
||||
|
||||
describe('Auth', function() {
|
||||
|
||||
//TODO: it 'Gets invited, creates an account'
|
||||
|
||||
//TODO: it 'Logs out'
|
||||
|
||||
//TODO: it 'Logs in'
|
||||
|
||||
//TODO: it 'Shows own map'
|
||||
|
||||
});
|
||||
|
||||
describe('Map controls', function() {
|
||||
|
||||
//TODO: it 'Sets location'
|
||||
|
||||
//TODO: it 'Clears location'
|
||||
|
||||
//TODO: it 'Starts tracking'
|
||||
|
||||
//TODO: it 'Stops tracking'
|
||||
|
||||
});
|
||||
|
||||
describe('Map popups', function() {
|
||||
|
||||
//TODO: it 'Opens Share popup'
|
||||
|
||||
//TODO: it 'Closes Share popup'
|
||||
|
||||
//TODO: it 'Opens Settings popup'
|
||||
|
||||
//TODO: it 'Closes Settings popup'
|
||||
|
||||
});
|
Loading…
Reference in New Issue