2014-07-06 08:43:14 +00:00
|
|
|
|
2015-10-11 22:59:51 +00:00
|
|
|
'use strict';
|
|
|
|
|
2015-10-12 04:59:30 +00:00
|
|
|
const request = require('../helpers/context').request;
|
2014-07-06 08:43:14 +00:00
|
|
|
|
|
|
|
describe('req.subdomains', function(){
|
|
|
|
it('should return subdomain array', function(){
|
2015-10-05 18:23:47 +00:00
|
|
|
const req = request();
|
2014-07-06 08:43:14 +00:00
|
|
|
req.header.host = 'tobi.ferrets.example.com';
|
|
|
|
req.app.subdomainOffset = 2;
|
|
|
|
req.subdomains.should.eql(['ferrets', 'tobi']);
|
|
|
|
|
|
|
|
req.app.subdomainOffset = 3;
|
|
|
|
req.subdomains.should.eql(['tobi']);
|
2015-10-12 20:36:41 +00:00
|
|
|
});
|
2014-07-06 08:43:14 +00:00
|
|
|
|
|
|
|
describe('with no host present', function(){
|
2015-10-05 18:23:47 +00:00
|
|
|
const req = request();
|
2014-07-06 08:43:14 +00:00
|
|
|
req.subdomains.should.eql([]);
|
2015-10-12 20:36:41 +00:00
|
|
|
});
|
|
|
|
});
|