@@ -250,6 +250,15 @@ describe('collection', () => {
250
250
} ) ;
251
251
} ) ;
252
252
253
+ it ( 'can be used relative to Firestore root with multiple arguments' , ( ) => {
254
+ return withTestDb ( db => {
255
+ const result = collection ( db , 'coll1/doc1' , '/coll2' , 'doc2/' , '/coll3/' ) ;
256
+ expect ( result ) . to . be . an . instanceOf ( CollectionReference ) ;
257
+ expect ( result . id ) . to . equal ( 'coll3' ) ;
258
+ expect ( result . path ) . to . equal ( 'coll1/doc1/coll2/doc2/coll3' ) ;
259
+ } ) ;
260
+ } ) ;
261
+
253
262
it ( 'can be used relative to collection' , ( ) => {
254
263
return withTestDb ( db => {
255
264
const result = collection ( collection ( db , 'coll' ) , 'doc/subcoll' ) ;
@@ -268,12 +277,19 @@ describe('collection', () => {
268
277
} ) ;
269
278
} ) ;
270
279
271
- it ( 'can be used with multiple arguments' , ( ) => {
280
+ it ( 'can be used relative to collection with multiple arguments' , ( ) => {
272
281
return withTestDb ( db => {
273
- const result = collection ( db , 'coll1/doc1' , 'coll2' ) ;
282
+ const col = collection ( db , 'coll1' ) ;
283
+ const result = collection (
284
+ col ,
285
+ '/doc1/coll2/doc2/' ,
286
+ '/coll3' ,
287
+ 'doc3/' ,
288
+ '/coll4/'
289
+ ) ;
274
290
expect ( result ) . to . be . an . instanceOf ( CollectionReference ) ;
275
- expect ( result . id ) . to . equal ( 'coll2 ' ) ;
276
- expect ( result . path ) . to . equal ( 'coll1/doc1/coll2' ) ;
291
+ expect ( result . id ) . to . equal ( 'coll4 ' ) ;
292
+ expect ( result . path ) . to . equal ( 'coll1/doc1/coll2/doc2/coll3/doc3/coll4 ' ) ;
277
293
} ) ;
278
294
} ) ;
279
295
0 commit comments