Skip to content

Commit f246874

Browse files
update absolutes
1 parent 9228ee0 commit f246874

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/absolutes.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/**
2+
* Module Dependencies
3+
*/
4+
5+
var absolute = require('../lib/absolutes');
6+
var cheerio = require('cheerio');
7+
var assert = require('assert');
8+
9+
describe('absolute URLs', function(){
10+
var path = 'http://example.com/foo.html';
11+
12+
it('should not convert URL', function(){
13+
var $el = cheerio.load('<a href="http://example.com/bar.html"></a>');
14+
assert.equal('<a href="http://example.com/bar.html"></a>', absolute(path, $el).html());
15+
});
16+
17+
it('should convert absolute URL', function(){
18+
var $el = cheerio.load('<a href="/bar.html"></a>');
19+
assert.equal('<a href="http://example.com/bar.html"></a>', absolute(path, $el).html());
20+
});
21+
22+
it('should convert relative URL', function(){
23+
var $el = cheerio.load('<a href="bar.html"></a>');
24+
assert.equal('<a href="http://example.com/bar.html"></a>', absolute(path, $el).html());
25+
});
26+
});

0 commit comments

Comments
 (0)