blob: 8aeb09e351633a1fa5bb0e93331dadc06f6348e4 [file] [log] [blame]
'use strict';
require('chai').should();
var parseUri = require('../../lib/deps/parseUri');
describe('test.parse-uri.js', function () {
it('parses a basic uri', function () {
var parsed = parseUri('http://foobar.com');
parsed.host.should.equal('foobar.com');
parsed.protocol.should.equal('http');
});
it('parses a complex uri', function () {
var parsed = parseUri('http://user:pass@foo.com/baz/bar/index.html?hey=yo');
parsed.should.deep.equal({
anchor: '',
query: 'hey=yo',
file: 'index.html',
directory: '/baz/bar/',
path: '/baz/bar/index.html',
relative: '/baz/bar/index.html?hey=yo',
port: '',
host: 'foo.com',
password: 'pass',
user: 'user',
userInfo: 'user:pass',
authority: 'user:pass@foo.com',
protocol: 'http',
source: 'http://user:pass@foo.com/baz/bar/index.html?hey=yo',
queryKey: { hey: 'yo' } }
);
});
});