@@ -59,6 +59,31 @@ var fixtures = {
5959 'youtube.com/attribution_link?u=/e/v/0EWbonj7f18' ,
6060 'youtube.com/attribution_link?u=/e/watch?v=0EWbonj7f18' ,
6161 'youtube.com/attribution_link?u=/e/watch?feature=related&v=0EWbonj7f18'
62+ ] ,
63+ // trailing slash
64+ trailing : [
65+ 'youtube.com/user/sandervandoorntv/watch/?v=WijF8aivOo8' ,
66+ 'youtube.com/user/sandervandoorntv/watch/?v=WijF8aivOo8&feature=related' ,
67+ 'youtube.com/user/sandervandoorntv/watch/?feature=related&v=WijF8aivOo8' ,
68+ 'youtube.com/watch/?v=0EWbonj7f18' ,
69+ 'youtube.com/watch/?feature=related&v=0EWbonj7f18' ,
70+ 'youtube.com/watch/?v=0EWbonj7f18&feature=related' ,
71+ 'youtube.com/embed/watch/?v=0EWbonj7f18' ,
72+ 'youtube.com/embed/watch/?feature=related&v=0EWbonj7f18' ,
73+ 'youtube.com/e/watch/?v=0EWbonj7f18' ,
74+ 'youtube.com/e/watch/?feature=related&v=0EWbonj7f18' ,
75+ 'youtube.com/attribution_link?u=/user/sandervandoorntv/watch/?v=WijF8aivOo8' ,
76+ 'youtube.com/attribution_link?u=/user/sandervandoorntv/watch/?v=WijF8aivOo8&feature=related' ,
77+ 'youtube.com/attribution_link?u=/user/sandervandoorntv/watch/?feature=related&v=WijF8aivOo8' ,
78+ 'youtube.com/attribution_link?u=/watch/?v=0EWbonj7f18' ,
79+ 'youtube.com/attribution_link?u=/watch/?feature=related&v=0EWbonj7f18' ,
80+ 'youtube.com/attribution_link?u=/watch/?v=0EWbonj7f18&feature=related' ,
81+ 'youtube.com/attribution_link?u=/embed/watch/?v=0EWbonj7f18' ,
82+ 'youtube.com/attribution_link?u=/embed/watch/?feature=related&v=0EWbonj7f18' ,
83+ 'youtube.com/attribution_link?u=/embed/v/0EWbonj7f18' ,
84+ 'youtube.com/attribution_link?u=/e/v/0EWbonj7f18' ,
85+ 'youtube.com/attribution_link?u=/e/watch/?v=0EWbonj7f18' ,
86+ 'youtube.com/attribution_link?u=/e/watch/?feature=related&v=0EWbonj7f18'
6287 ]
6388} ;
6489
@@ -82,6 +107,12 @@ describe('youtube-regex', function() {
82107 } ) ;
83108 done ( ) ;
84109 } ) ;
110+ it ( 'trailing slash (watch/?v=id) links' , function ( done ) {
111+ fixtures . trailing . forEach ( function each ( link ) {
112+ assert . ok ( test ( link ) ) ;
113+ } ) ;
114+ done ( ) ;
115+ } ) ;
85116 } ) ;
86117 describe ( 'should NOT match id from' , function ( ) {
87118 it ( 'invalid links' , function ( done ) {
0 commit comments