File tree Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Expand file tree Collapse file tree 1 file changed +26
-0
lines changed Original file line number Diff line number Diff line change
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
+ } ) ;
You can’t perform that action at this time.
0 commit comments