@@ -178,6 +178,23 @@ describe('Kuzzle methods', function () {
178178 kuzzle = new Kuzzle ( 'foo' ) ;
179179 } ) ;
180180
181+ it ( 'should throw an error if arguments are not strings' , ( ) => {
182+ kuzzle . defaultIndex = 'foobar' ;
183+ should ( function ( ) { kuzzle . dataCollectionFactory ( undefined ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
184+ should ( function ( ) { kuzzle . dataCollectionFactory ( 'foo' , undefined ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
185+ should ( function ( ) { kuzzle . dataCollectionFactory ( null ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
186+ should ( function ( ) { kuzzle . dataCollectionFactory ( 'foo' , null ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
187+ should ( function ( ) { kuzzle . dataCollectionFactory ( 123 ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
188+ should ( function ( ) { kuzzle . dataCollectionFactory ( 123 , 'foo' ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
189+ should ( function ( ) { kuzzle . dataCollectionFactory ( 'foo' , 123 ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
190+ should ( function ( ) { kuzzle . dataCollectionFactory ( { foo : 'bar' } ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
191+ should ( function ( ) { kuzzle . dataCollectionFactory ( { foo : 'bar' } , 'foo' ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
192+ should ( function ( ) { kuzzle . dataCollectionFactory ( 'foo' , { foo : 'bar' } ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
193+ should ( function ( ) { kuzzle . dataCollectionFactory ( [ 'bar' ] ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
194+ should ( function ( ) { kuzzle . dataCollectionFactory ( 'foo' , [ 'bar' ] ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
195+ should ( function ( ) { kuzzle . dataCollectionFactory ( [ 'bar' ] , 'foo' ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
196+ } ) ;
197+
181198 it ( 'should throw an error if the kuzzle instance has been invalidated' , function ( ) {
182199 kuzzle . disconnect ( ) ;
183200 should ( function ( ) { kuzzle . dataCollectionFactory ( 'foo' ) ; } ) . throw ( Error ) ;
@@ -204,10 +221,6 @@ describe('Kuzzle methods', function () {
204221 collection = kuzzle . dataCollectionFactory ( 'foo' ) ;
205222 should ( collection ) . be . instanceof ( KuzzleDataCollection ) ;
206223 should ( collection . index ) . be . eql ( defaultIndex ) ;
207-
208- collection = kuzzle . dataCollectionFactory ( 'foo' , { some : 'headers' } ) ;
209- should ( collection ) . be . instanceof ( KuzzleDataCollection ) ;
210- should ( collection . index ) . be . eql ( defaultIndex ) ;
211224 } ) ;
212225
213226 it ( 'should throw an error if no index is provided and no default index has been set' , function ( done ) {
0 commit comments