2016-03-31 17:06:21 -06:00
|
|
|
var chai = require('chai'),
|
|
|
|
chaiHttp = require('chai-http'),
|
2016-06-12 20:08:43 -06:00
|
|
|
request = require('supertest'),
|
2016-03-31 17:06:21 -06:00
|
|
|
server = require('./server'),
|
2016-08-09 23:51:49 -06:00
|
|
|
should = chai.should(),
|
|
|
|
expect = chai.expect();
|
2016-03-31 17:06:21 -06:00
|
|
|
chai.use(chaiHttp);
|
|
|
|
|
2016-06-12 20:08:43 -06:00
|
|
|
describe('Index', function() {
|
2016-08-09 23:51:49 -06:00
|
|
|
// I think this restarts the server after each try?
|
2016-06-12 20:08:43 -06:00
|
|
|
// var server;
|
|
|
|
// beforeEach(function() {
|
|
|
|
// server = require('./server');
|
|
|
|
// });
|
|
|
|
// afterEach(function() {
|
|
|
|
// server.close();
|
|
|
|
// });
|
|
|
|
|
2016-03-31 17:06:21 -06:00
|
|
|
it('Displays homepage', function(done){
|
2016-06-12 20:08:43 -06:00
|
|
|
request(server).get('/')
|
|
|
|
.expect(200)
|
|
|
|
.end(function(err,res){ done(); });
|
2016-03-31 17:06:21 -06:00
|
|
|
});
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-03-31 17:06:21 -06:00
|
|
|
it('Displays robots.txt', function(done){
|
2016-06-12 20:08:43 -06:00
|
|
|
request(server).get('/robots.txt')
|
|
|
|
.expect(200)
|
|
|
|
.expect('Content-Type', /text/)
|
|
|
|
.end(function(err,res){ done(); });
|
|
|
|
});
|
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
it('Displays demo map', function(done){
|
2016-06-12 20:08:43 -06:00
|
|
|
request(server).get('/map/keith')
|
|
|
|
.expect(200)
|
|
|
|
.end(function(err,res){ done(); });
|
2016-03-31 17:06:21 -06:00
|
|
|
});
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
});
|
|
|
|
|
|
|
|
describe('Auth', function() {
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
it('Creates an account', function(done){
|
|
|
|
request(server).get('/login')
|
2016-06-12 20:08:43 -06:00
|
|
|
.expect(200)
|
2016-08-09 23:51:49 -06:00
|
|
|
.end(function(err,res){
|
|
|
|
//TODO: google authentication
|
|
|
|
it('Logs out', function(done){
|
|
|
|
request(server).get('/logout')
|
|
|
|
.expect(200)
|
|
|
|
.end(function(err,res){
|
|
|
|
it('Logs in', function(done){
|
|
|
|
request(server).get('/logout')
|
|
|
|
.expect(200)
|
|
|
|
.end(function(err,res){
|
|
|
|
cbc=2;
|
|
|
|
var deletesAccount = function(done){
|
|
|
|
it('Deletes own account', function(){
|
|
|
|
//TODO: Delete account via GUI
|
|
|
|
});
|
|
|
|
}
|
|
|
|
it('Shows own map', function(done){
|
|
|
|
request(server).get('/map')
|
|
|
|
.expect(200)
|
|
|
|
//TODO: Expect no js errors
|
|
|
|
.end(function(err,res){
|
|
|
|
if (cbc<2){ deletesAccount(); }
|
|
|
|
else { cbc--; }
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('Has the correct account info', function(done){
|
|
|
|
//TODO: Check account info
|
|
|
|
if (cbc<2){ deletesAccount(); }
|
|
|
|
else { cbc--; }
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
done();
|
|
|
|
});
|
|
|
|
});
|
|
|
|
done();
|
2016-06-12 20:08:43 -06:00
|
|
|
});
|
2016-03-31 17:06:21 -06:00
|
|
|
});
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
//TODO: it('Has the correct account info', function(done){
|
|
|
|
|
|
|
|
// });
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
//TODO: it('Logs out', function(done){
|
|
|
|
|
|
|
|
// });
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
//TODO: it('Logs in', function(done){
|
|
|
|
|
|
|
|
// });
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
//TODO: it('Shows own map', function(done){
|
|
|
|
|
|
|
|
// });
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
//TODO: it('Deletes account', function(done){
|
|
|
|
|
|
|
|
// });
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-03-31 17:06:21 -06:00
|
|
|
});
|
2016-06-12 20:08:43 -06:00
|
|
|
|
|
|
|
describe('Map controls', function() {
|
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
//TODO: it('Sets location', function(done){
|
|
|
|
|
|
|
|
// });
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
//TODO: it('Clears location', function(done){
|
|
|
|
|
|
|
|
// });
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
//TODO: it('Starts tracking', function(done){
|
|
|
|
|
|
|
|
// });
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
//TODO: it('Stops tracking', function(done){
|
|
|
|
|
|
|
|
// });
|
2016-06-12 20:08:43 -06:00
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Map popups', function() {
|
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
//TODO: it('Opens Share popup', function(done){
|
|
|
|
|
|
|
|
// });
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
//TODO: it('Closes Share popup', function(done){
|
|
|
|
|
|
|
|
// });
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
//TODO: it('Opens Settings popup', function(done){
|
|
|
|
|
|
|
|
// });
|
2016-06-12 20:08:43 -06:00
|
|
|
|
2016-08-09 23:51:49 -06:00
|
|
|
//TODO: it('Closes Settings popup', function(done){
|
|
|
|
|
|
|
|
// });
|
2016-06-12 20:08:43 -06:00
|
|
|
|
|
|
|
});
|