Cleanup url handling

This commit is contained in:
Tankred Hase
2016-06-10 12:06:08 +02:00
parent 405bb84ca6
commit d5bd65b4bc
8 changed files with 92 additions and 25 deletions

View File

@@ -135,9 +135,21 @@ describe('Util Unit Tests', () => {
});
});
describe('getOrigin', () => {
describe('origin', () => {
it('should work', () => {
expect(util.getOrigin({host:'h', protocol:'p'})).to.exist;
expect(util.origin({ secure:true, host:'h', protocol:'p' })).to.exist;
});
});
describe('url', () => {
it('should work with resource', () => {
let url = util.url({ host:'localhost', protocol:'http'}, '/foo');
expect(url).to.equal('http://localhost/foo');
});
it('should work without resource', () => {
let url = util.url({ host:'localhost', protocol:'http'});
expect(url).to.equal('http://localhost');
});
});