@@ -8,22 +8,96 @@ function test(str) {
88}
99
1010var fixtures = {
11- invalid : [
12- 'NoNoNo'
13- ] ,
14- shortlinks : [
15- ] ,
16- mixed : [
17- ] ,
18- attrlink : [
19- ]
11+ plain : {
12+ ok : [
13+ 'https://vimeo.com/62092214' ,
14+ 'http://vimeo.com/62092214' ,
15+ 'https://www.vimeo.com/62092214'
16+ ] ,
17+ not_ok : [
18+ 'NONONO' ,
19+ 'http://vimeo/62092214' ,
20+ 'http://vimeo.com/foo' ,
21+ ]
22+ } ,
23+ channels : {
24+ ok : [
25+ 'https://vimeo.com/channels/documentaryfilm/128373915' ,
26+ 'http://vimeo.com/channels/documentaryfilm/128373915'
27+ ] ,
28+ not_ok : [
29+ 'https://vimeo.com/channels/foo-barr/documentaryfilm/128373915' ,
30+ ]
31+ } ,
32+ groups : {
33+ ok : [
34+ 'https://vimeo.com/groups/musicvideo/videos/126199390' ,
35+ 'http://vimeo.com/groups/musicvideo/videos/126199390'
36+ ] ,
37+ not_ok : [
38+ 'http://vimeo.com/groups/musicvideo/vid/126199390'
39+ ]
40+ } ,
41+ attrlink : {
42+ ok : [
43+ 'https://vimeo.com/62092214?query=foo'
44+ ] ,
45+ not_ok : [
46+ 'https://vimeo.com.omomom/62092214?query=foo'
47+ ]
48+ }
2049} ;
2150
22- describe ( 'vimeo-regex' , function ( ) {
23- describe ( 'should match id from' , function ( ) {
24- it ( 'shortlinks' , function ( done ) {
25- fixtures . shortlinks . forEach ( function each ( link ) {
26- assert . ok ( test ( link ) ) ;
51+
52+ describe ( 'vimeo-regex ->' , function ( ) {
53+ describe ( 'should be ok with ->' , function ( ) {
54+ it ( 'plain url' , function ( done ) {
55+ fixtures . plain . ok . forEach ( function ( link ) {
56+ assert . ok ( test ( link ) , link ) ;
57+ } ) ;
58+ done ( ) ;
59+ } ) ;
60+ it ( 'channels url' , function ( done ) {
61+ fixtures . channels . ok . forEach ( function ( link ) {
62+ assert . ok ( test ( link ) , link ) ;
63+ } ) ;
64+ done ( ) ;
65+ } ) ;
66+ it ( 'groups url' , function ( done ) {
67+ fixtures . plain . ok . forEach ( function ( link ) {
68+ assert . ok ( test ( link ) , link ) ;
69+ } ) ;
70+ done ( ) ;
71+ } ) ;
72+ it ( 'attribute url' , function ( done ) {
73+ fixtures . attrlink . ok . forEach ( function ( link ) {
74+ assert . ok ( test ( link ) , link ) ;
75+ } ) ;
76+ done ( ) ;
77+ } ) ;
78+ } ) ;
79+ describe ( 'should falied with ->' , function ( ) {
80+ it ( 'plain url' , function ( done ) {
81+ fixtures . plain . not_ok . forEach ( function ( link ) {
82+ assert . equal ( test ( link ) , false , link ) ;
83+ } ) ;
84+ done ( ) ;
85+ } ) ;
86+ it ( 'channels url' , function ( done ) {
87+ fixtures . channels . not_ok . forEach ( function ( link ) {
88+ assert . equal ( test ( link ) , false , link ) ;
89+ } ) ;
90+ done ( ) ;
91+ } ) ;
92+ it ( 'groups url' , function ( done ) {
93+ fixtures . plain . not_ok . forEach ( function ( link ) {
94+ assert . equal ( test ( link ) , false , link ) ;
95+ } ) ;
96+ done ( ) ;
97+ } ) ;
98+ it ( 'attribute url' , function ( done ) {
99+ fixtures . attrlink . not_ok . forEach ( function ( link ) {
100+ assert . equal ( test ( link ) , false , link ) ;
27101 } ) ;
28102 done ( ) ;
29103 } ) ;
0 commit comments