-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathroutes.js
49 lines (36 loc) · 1.19 KB
/
routes.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
var request = require('supertest');
var should = require('should');
var utls = require('lockit-utils');
var config = require('./app/config.js');
var app = require('./app/app.js');
var db = utls.getDatabase(config);
var adapter = require(db.adapter)(config);
var _config = JSON.parse(JSON.stringify(config));
_config.port = 5100;
_config.deleteAccount.route = '/delete-me';
var _app = app(_config);
describe('# custom routes', function() {
describe('GET /delete-account', function() {
it('should work with custom routes', function(done) {
request(_app)
.get('/delete-me')
.end(function(err, res) {
res.statusCode.should.equal(200);
res.text.should.containEql('There is no going back. Please be certain.');
done();
});
});
});
describe('POST /delete-account', function() {
it('should work with custom routes', function(done) {
request(_app)
.post('/delete-me')
.send({name: '', phrase: 'lorem', password: 'secret'})
.end(function(error, res) {
res.statusCode.should.equal(403);
res.text.should.containEql('All fields are required');
done();
});
});
});
});