-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhello_world.js
48 lines (34 loc) · 1.04 KB
/
hello_world.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
var should = require('should');
var request = require('supertest');
var server = require('../../../app');
describe('controllers', function() {
describe('hello_world', function() {
describe('GET /hello', function() {
it('should return a default string', function(done) {
request(server)
.get('/hello')
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200)
.end(function(err, res) {
should.not.exist(err);
res.body.should.eql('Hello, stranger!');
done();
});
});
it('should accept a name parameter', function(done) {
request(server)
.get('/hello')
.query({ name: 'Scott'})
.set('Accept', 'application/json')
.expect('Content-Type', /json/)
.expect(200)
.end(function(err, res) {
should.not.exist(err);
res.body.should.eql('Hello, Scott!');
done();
});
});
});
});
});