-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Lukasz Kujawa
committed
Dec 30, 2013
1 parent
a08a3bb
commit 7ac195f
Showing
4 changed files
with
65 additions
and
14 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
var assert = require( "assert" ); | ||
var UrlTool = require('../../../webcrawler/utils/urltool'); | ||
var helper = require( "../../helper" ); | ||
|
||
describe('UrlDoc', function(){ | ||
|
||
describe('#UrlDoc', function(){ | ||
|
||
it('should handle ../ urls', function(){ | ||
var env = helper.getEnv( 'http://www.example.com/foo' ); | ||
|
||
var urls = [ | ||
|
||
{ input: 'http://www.example.com/foo/../bar', | ||
output: 'http://www.example.com/bar' }, | ||
|
||
{ input: 'http://www.example.com/foo/../../../bar', | ||
output: 'http://www.example.com/bar' }, | ||
|
||
{ input: 'http://www.example.com/../', | ||
output: 'http://www.example.com/' }, | ||
|
||
{ input: 'http://www.example.com/foo/../../../bar/../', | ||
output: 'http://www.example.com/' }, | ||
] | ||
|
||
for( i in urls ) { | ||
var inputUrl = urls[i].input; | ||
var outputUrl = urls[i].output; | ||
|
||
_url = UrlTool.nomalise( inputUrl, env ); | ||
assert.equal( _url, outputUrl ); | ||
} | ||
}); | ||
|
||
}); | ||
|
||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters