build: update example dependencies
[express.git] / test / acceptance / vhost.js
blob1b633d4b2bcf469d8536cf30f78f0ce0ac0995f0
1 var app = require('../../examples/vhost')
2 var request = require('supertest')
4 describe('vhost', function(){
5   describe('example.com', function(){
6     describe('GET /', function(){
7       it('should say hello', function(done){
8         request(app)
9         .get('/')
10         .set('Host', 'example.com')
11         .expect(200, /hello/i, done)
12       })
13     })
15     describe('GET /foo', function(){
16       it('should say foo', function(done){
17         request(app)
18         .get('/foo')
19         .set('Host', 'example.com')
20         .expect(200, 'requested foo', done)
21       })
22     })
23   })
25   describe('foo.example.com', function(){
26     describe('GET /', function(){
27       it('should redirect to /foo', function(done){
28         request(app)
29         .get('/')
30         .set('Host', 'foo.example.com')
31         .expect(302, /Redirecting to http:\/\/example.com:3000\/foo/, done)
32       })
33     })
34   })
36   describe('bar.example.com', function(){
37     describe('GET /', function(){
38       it('should redirect to /bar', function(done){
39         request(app)
40         .get('/')
41         .set('Host', 'bar.example.com')
42         .expect(302, /Redirecting to http:\/\/example.com:3000\/bar/, done)
43       })
44     })
45   })