@@ -181,9 +181,9 @@ describe('Kuzzle methods', function () {
181
181
it ( 'should throw an error if arguments are not strings' , ( ) => {
182
182
kuzzle . defaultIndex = 'foobar' ;
183
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 / ) ;
184
+ should ( function ( ) { kuzzle . dataCollectionFactory ( undefined , 'foo' ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
185
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 / ) ;
186
+ should ( function ( ) { kuzzle . dataCollectionFactory ( null , 'foo' ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
187
187
should ( function ( ) { kuzzle . dataCollectionFactory ( 123 ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
188
188
should ( function ( ) { kuzzle . dataCollectionFactory ( 123 , 'foo' ) ; } ) . throw ( / s t r i n g e x p e c t e d / ) ;
189
189
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 () {
203
203
it ( 'should create and store the data collection instance if needed' , function ( ) {
204
204
var collection = kuzzle . dataCollectionFactory ( 'foo' , 'bar' ) ;
205
205
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 ) ;
207
207
should ( collection ) . be . instanceof ( KuzzleDataCollection ) ;
208
208
} ) ;
209
209
210
210
it ( 'should simply pull the collection from the collection history if reinvoked' , function ( ) {
211
211
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' ) ;
213
213
} ) ;
214
214
215
215
it ( 'should use the default index if no index is provided' , function ( ) {
@@ -223,14 +223,8 @@ describe('Kuzzle methods', function () {
223
223
should ( collection . index ) . be . eql ( defaultIndex ) ;
224
224
} ) ;
225
225
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 / ) ;
234
228
} ) ;
235
229
} ) ;
236
230
0 commit comments