@@ -7,7 +7,7 @@ if(process.env.NO_WATCH_TESTS) {
77 return ;
88}
99
10- require ( "should" ) ;
10+ var should = require ( "should" ) ;
1111var path = require ( "path" ) ;
1212var fs = require ( "fs" ) ;
1313
@@ -19,6 +19,49 @@ var fileSubdir = path.join(fixtures, "subdir", "watched-file.txt");
1919
2020describe ( "NodeWatchFileSystem" , function ( ) {
2121 this . timeout ( 10000 ) ;
22+
23+ it ( 'should throw if \'files\' argument is not an array' , function ( ) {
24+ should ( function ( ) {
25+ new NodeWatchFileSystem ( ) . watch ( undefined )
26+ } ) . throw ( "Invalid arguments: 'files'" ) ;
27+ } ) ;
28+
29+ it ( 'should throw if \'dirs\' argument is not an array' , function ( ) {
30+ should ( function ( ) {
31+ new NodeWatchFileSystem ( ) . watch ( [ ] , undefined )
32+ } ) . throw ( "Invalid arguments: 'dirs'" ) ;
33+ } ) ;
34+
35+ it ( 'should throw if \'missing\' argument is not an array' , function ( ) {
36+ should ( function ( ) {
37+ new NodeWatchFileSystem ( ) . watch ( [ ] , [ ] , undefined )
38+ } ) . throw ( "Invalid arguments: 'missing'" ) ;
39+ } ) ;
40+
41+ it ( 'should throw if \'starttime\' argument is missing' , function ( ) {
42+ should ( function ( ) {
43+ new NodeWatchFileSystem ( ) . watch ( [ ] , [ ] , [ ] , '42' , { } , function ( ) { } )
44+ } ) . throw ( "Invalid arguments: 'startTime'" ) ;
45+ } ) ;
46+
47+ it ( 'should throw if \'callback\' argument is missing' , function ( ) {
48+ should ( function ( ) {
49+ new NodeWatchFileSystem ( ) . watch ( [ ] , [ ] , [ ] , 42 , { } , undefined )
50+ } ) . throw ( "Invalid arguments: 'callback'" ) ;
51+ } ) ;
52+
53+ it ( 'should throw if \'options\' argument is invalid' , function ( ) {
54+ should ( function ( ) {
55+ new NodeWatchFileSystem ( ) . watch ( [ ] , [ ] , [ ] , 42 , 'options' , function ( ) { } )
56+ } ) . throw ( "Invalid arguments: 'options'" ) ;
57+ } ) ;
58+
59+ it ( 'should throw if \'callbackUndelayed\' argument is invalid' , function ( ) {
60+ should ( function ( ) {
61+ new NodeWatchFileSystem ( ) . watch ( [ ] , [ ] , [ ] , 42 , { } , function ( ) { } , 'undefined' )
62+ } ) . throw ( "Invalid arguments: 'callbackUndelayed'" ) ;
63+ } ) ;
64+
2265 it ( "should register a file change (change delayed)" , function ( done ) {
2366 var startTime = new Date ( ) . getTime ( ) ;
2467 var wfs = new NodeWatchFileSystem ( ) ;
0 commit comments