@@ -181,9 +181,9 @@ describe('Kuzzle methods', function () {
181181 it ( 'should throw an error if arguments are not strings' , ( ) => {
182182 kuzzle . defaultIndex = 'foobar' ;
183183 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 / ) ;
184+ should ( function ( ) { kuzzle . dataCollectionFactory ( undefined , 'foo' ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
185185 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 / ) ;
186+ should ( function ( ) { kuzzle . dataCollectionFactory ( null , 'foo' ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
187187 should ( function ( ) { kuzzle . dataCollectionFactory ( 123 ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
188188 should ( function ( ) { kuzzle . dataCollectionFactory ( 123 , 'foo' ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
189189 should ( function ( ) { kuzzle . dataCollectionFactory ( 'foo' , 123 ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
@@ -203,13 +203,13 @@ describe('Kuzzle methods', function () {
203203 it ( 'should create and store the data collection instance if needed' , function ( ) {
204204 var collection = kuzzle . dataCollectionFactory ( 'foo' , 'bar' ) ;
205205
206- should ( kuzzle . collections [ 'foo ' ] [ 'bar ' ] ) . not . be . undefined ( ) . and . be . instanceof ( KuzzleDataCollection ) ;
206+ should ( kuzzle . collections [ 'bar ' ] [ 'foo ' ] ) . not . be . undefined ( ) . and . be . instanceof ( KuzzleDataCollection ) ;
207207 should ( collection ) . be . instanceof ( KuzzleDataCollection ) ;
208208 } ) ;
209209
210210 it ( 'should simply pull the collection from the collection history if reinvoked' , function ( ) {
211211 kuzzle . collections [ 'foo' ] = { bar : 'qux' } ;
212- should ( kuzzle . dataCollectionFactory ( 'foo ' , 'bar ' ) ) . be . a . String ( ) . and . be . exactly ( 'qux' ) ;
212+ should ( kuzzle . dataCollectionFactory ( 'bar ' , 'foo ' ) ) . be . a . String ( ) . and . be . exactly ( 'qux' ) ;
213213 } ) ;
214214
215215 it ( 'should use the default index if no index is provided' , function ( ) {
@@ -223,14 +223,8 @@ describe('Kuzzle methods', function () {
223223 should ( collection . index ) . be . eql ( defaultIndex ) ;
224224 } ) ;
225225
226- it ( 'should throw an error if no index is provided and no default index has been set' , function ( done ) {
227- try {
228- kuzzle . dataCollectionFactory ( 'foo' ) ;
229- done ( new Error ( 'Should have thrown an error' ) ) ;
230- }
231- catch ( e ) {
232- done ( ) ;
233- }
226+ it ( 'should throw an error if no index is provided and no default index has been set' , ( ) => {
227+ should ( function ( ) { kuzzle . dataCollectionFactory ( 'foo' ) ; } ) . throw ( / n o i n d e x s p e c i f i e d / ) ;
234228 } ) ;
235229 } ) ;
236230
0 commit comments