Skip to content

Commit 7886ab6

Browse files
committed
fix unit tests
1 parent e6b5590 commit 7886ab6

File tree

1 file changed

+14
-17
lines changed

1 file changed

+14
-17
lines changed

tests/AutolinkerSpec.js

Lines changed: 14 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -185,9 +185,9 @@ describe( "Autolinker", function() {
185185
} );
186186

187187

188-
it( "should autolink protocols with at least two characters", function() {
189-
var result = autolinker.link( 'link this: gg://example.com/' );
190-
expect( result ).toBe( 'link this: <a href="gg://example.com/">gg://example.com</a>' );
188+
it( "should autolink protocols with at least one character", function() {
189+
var result = autolinker.link( 'link this: g://example.com/' );
190+
expect( result ).toBe( 'link this: <a href="g://example.com/">g://example.com</a>' );
191191
} );
192192

193193

@@ -197,12 +197,6 @@ describe( "Autolinker", function() {
197197
} );
198198

199199

200-
it( "should NOT autolink a protocol with only one character", function() {
201-
var result = autolinker.link( 'do not link this: a://example' );
202-
expect( result ).toBe( 'do not link this: a://example' );
203-
} );
204-
205-
206200
it( "should autolink protocols with digits, dashes, dots, and plus signs in their names", function() {
207201
var result1 = autolinker.link( 'link this: a1://example' );
208202
expect( result1 ).toBe( 'link this: <a href="a1://example">a1://example</a>' );
@@ -223,17 +217,20 @@ describe( "Autolinker", function() {
223217

224218

225219
it( "should NOT autolink protocols that start with a digit, dash, plus sign, or dot, as per http://tools.ietf.org/html/rfc3986#section-3.1", function() {
226-
var result = autolinker.link( 'do not link this: 1a://example' );
227-
expect( result ).toBe( 'do not link this: 1a://example' );
220+
var result = autolinker.link( 'do not link first char: 1a://example' );
221+
expect( result ).toBe( 'do not link first char: 1<a href="a://example">a://example</a>' );
222+
223+
var result2 = autolinker.link( 'do not link first char: -a://example' );
224+
expect( result2 ).toBe( 'do not link first char: -<a href="a://example">a://example</a>' );
228225

229-
var result2 = autolinker.link( 'do not link this: -a://example' );
230-
expect( result2 ).toBe( 'do not link this: -a://example' );
226+
var result3 = autolinker.link( 'do not link first char: +a://example' );
227+
expect( result3 ).toBe( 'do not link first char: +<a href="a://example">a://example</a>' );
231228

232-
var result3 = autolinker.link( 'do not link this: +a://example' );
233-
expect( result3 ).toBe( 'do not link this: +a://example' );
229+
var result4 = autolinker.link( 'do not link first char: .a://example' );
230+
expect( result4 ).toBe( 'do not link first char: .<a href="a://example">a://example</a>' );
234231

235-
var result4 = autolinker.link( 'do not link this: .a://example' );
236-
expect( result4 ).toBe( 'do not link this: .a://example' );
232+
var result5 = autolinker.link( 'do not link first char: .aa://example' );
233+
expect( result5 ).toBe( 'do not link first char: .<a href="aa://example">aa://example</a>' );
237234
} );
238235

239236

0 commit comments

Comments
 (0)