@@ -34,6 +34,51 @@ describe('parallel', function() {
3434 done ( ) ;
3535 } ) ;
3636
37+ it ( 'should throw on non-valid tasks combined with valid tasks' , function ( done ) {
38+ function fail ( ) {
39+ taker . parallel ( 'test1' , 'test2' , 'test3' , { } ) ;
40+ }
41+
42+ expect ( fail ) . toThrow ( / T a s k n e v e r d e f i n e d : / ) ;
43+ done ( ) ;
44+ } ) ;
45+
46+ it ( 'should throw on tasks array with both valid and non-valid tasks' , function ( done ) {
47+ function fail ( ) {
48+ taker . parallel ( [ 'test1' , 'test2' , 'test3' , { } ] ) ;
49+ }
50+
51+ expect ( fail ) . toThrow ( / T a s k n e v e r d e f i n e d : / ) ;
52+ done ( ) ;
53+ } ) ;
54+
55+ it ( 'should throw on non-valid task' , function ( done ) {
56+ function fail ( ) {
57+ taker . parallel ( { } ) ;
58+ }
59+
60+ expect ( fail ) . toThrow ( / T a s k n e v e r d e f i n e d : / ) ;
61+ done ( ) ;
62+ } ) ;
63+
64+ it ( 'should throw when no tasks specified' , function ( done ) {
65+ function fail ( ) {
66+ taker . parallel ( ) ;
67+ }
68+
69+ expect ( fail ) . toThrow ( / O n e o r m o r e t a s k s s h o u l d b e c o m b i n e d u s i n g s e r i e s o r p a r a l l e l / ) ;
70+ done ( ) ;
71+ } ) ;
72+
73+ it ( 'should throw on empty array of registered tasks' , function ( done ) {
74+ function fail ( ) {
75+ taker . parallel ( [ ] ) ;
76+ }
77+
78+ expect ( fail ) . toThrow ( / O n e o r m o r e t a s k s s h o u l d b e c o m b i n e d u s i n g s e r i e s o r p a r a l l e l / ) ;
79+ done ( ) ;
80+ } ) ;
81+
3782 it ( 'should take only one array of registered tasks' , function ( done ) {
3883 taker . parallel ( [ 'test1' , 'test2' , 'test3' ] ) ( function ( err , results ) {
3984 expect ( results ) . toEqual ( [ 1 , 2 , 3 ] ) ;
0 commit comments