Example #1
0
 it('should parse http://localhost/foo?ferret=toby', function(){
     var obj = url.parse('http://localhost/foo?ferret=toby');
     expect(obj.querystring).to.equal('ferret=toby');
     expect(obj.path).to.equal('/foo');
     expect(obj.scheme).to.equal('http');
     expect(obj.domain).to.equal('localhost');
 });
Example #2
0
 it('should parse invalid input to undefined', function() {
     var obj = url.parse('asdfasdf');
     expect(obj.scheme).to.be.undefined;
     expect(obj['user_info']).to.be.undefined;
     expect(obj.domain).to.be.undefined;
     expect(obj.port).to.be.undefined;
     expect(obj.path).to.equal('asdfasdf');
     expect(obj.querystring).to.be.undefined;
     expect(obj.fragment).to.be.undefined;
 });