@@ -88,19 +88,8 @@ describe('FirebaseListFactory', () => {
8888
8989 describe ( '<constructor>' , ( ) => {
9090
91- it ( 'should accept a Firebase db path in the constructor' , ( ) => {
92- const list = FirebaseListFactory ( `questions` ) ;
93- expect ( list instanceof FirebaseListObservable ) . toBe ( true ) ;
94- } ) ;
95-
9691 it ( 'should accept a Firebase db ref in the constructor' , ( ) => {
97- const list = FirebaseListFactory ( firebase . database ( ) . ref ( `questions` ) ) ;
98- expect ( list instanceof FirebaseListObservable ) . toBe ( true ) ;
99- } ) ;
100-
101- it ( 'should take an absolute url in the constructor' , ( ) => {
102- const absoluteUrl = COMMON_CONFIG . databaseURL + '/questions' ;
103- const list = FirebaseListFactory ( absoluteUrl ) ;
92+ const list = FirebaseListFactory ( app . database ( ) . ref ( `questions` ) ) ;
10493 expect ( list instanceof FirebaseListObservable ) . toBe ( true ) ;
10594 } ) ;
10695
@@ -120,7 +109,7 @@ describe('FirebaseListFactory', () => {
120109 it ( 'equalTo - should re-run a query when the observable value has emitted' , ( done : any ) => {
121110
122111 const subject = new Subject ( ) ;
123- const observable = FirebaseListFactory ( questionsPath , {
112+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
124113 query : {
125114 orderByChild : 'height' ,
126115 equalTo : subject
@@ -133,7 +122,7 @@ describe('FirebaseListFactory', () => {
133122 it ( 'startAt - should re-run a query when the observable value has emitted' , ( done : any ) => {
134123
135124 const subject = new Subject ( ) ;
136- const observable = FirebaseListFactory ( questionsPath , {
125+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
137126 query : {
138127 orderByChild : 'height' ,
139128 startAt : subject
@@ -146,7 +135,7 @@ describe('FirebaseListFactory', () => {
146135 it ( 'endAt - should re-run a query when the observable value has emitted' , ( done : any ) => {
147136
148137 const subject = new Subject ( ) ;
149- const observable = FirebaseListFactory ( questionsPath , {
138+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
150139 query : {
151140 orderByChild : 'height' ,
152141 endAt : subject
@@ -158,7 +147,7 @@ describe('FirebaseListFactory', () => {
158147
159148 it ( 'should throw an error if limitToLast and limitToFirst are chained' , ( ) => {
160149
161- const observable = FirebaseListFactory ( questionsPath , {
150+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
162151 query : {
163152 orderByChild : 'height' ,
164153 limitToFirst : 10 ,
@@ -170,7 +159,7 @@ describe('FirebaseListFactory', () => {
170159
171160 it ( 'should throw an error if startAt is used with equalTo' , ( ) => {
172161
173- const observable = FirebaseListFactory ( questionsPath , {
162+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
174163 query : {
175164 orderByChild : 'height' ,
176165 equalTo : 10 ,
@@ -182,7 +171,7 @@ describe('FirebaseListFactory', () => {
182171
183172 it ( 'should throw an error if endAt is used with equalTo' , ( ) => {
184173
185- const observable = FirebaseListFactory ( questionsPath , {
174+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
186175 query : {
187176 orderByChild : 'height' ,
188177 equalTo : 10 ,
@@ -194,7 +183,7 @@ describe('FirebaseListFactory', () => {
194183
195184 it ( 'should throw an error if startAt and endAt is used with equalTo' , ( ) => {
196185
197- const observable = FirebaseListFactory ( questionsPath , {
186+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
198187 query : {
199188 orderByChild : 'height' ,
200189 equalTo : 10 ,
@@ -219,7 +208,7 @@ describe('FirebaseListFactory', () => {
219208 it ( 'equalTo - should re-run a query when the observable value has emitted' , ( done : any ) => {
220209
221210 const subject = new Subject ( ) ;
222- const observable = FirebaseListFactory ( questionsPath , {
211+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
223212 query : {
224213 orderByValue : true ,
225214 equalTo : subject
@@ -232,7 +221,7 @@ describe('FirebaseListFactory', () => {
232221 it ( 'startAt - should re-run a query when the observable value has emitted' , ( done : any ) => {
233222
234223 const subject = new Subject ( ) ;
235- const observable = FirebaseListFactory ( questionsPath , {
224+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
236225 query : {
237226 orderByValue : true ,
238227 startAt : subject
@@ -245,7 +234,7 @@ describe('FirebaseListFactory', () => {
245234 it ( 'endAt - should re-run a query when the observable value has emitted' , ( done : any ) => {
246235
247236 const subject = new Subject ( ) ;
248- const observable = FirebaseListFactory ( questionsPath , {
237+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
249238 query : {
250239 orderByValue : true ,
251240 endAt : subject
@@ -269,7 +258,7 @@ describe('FirebaseListFactory', () => {
269258 it ( 'equalTo - should re-run a query when the observable value has emitted' , ( done : any ) => {
270259
271260 const subject = new Subject ( ) ;
272- const observable = FirebaseListFactory ( questionsPath , {
261+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
273262 query : {
274263 orderByKey : true ,
275264 equalTo : subject
@@ -282,7 +271,7 @@ describe('FirebaseListFactory', () => {
282271 it ( 'startAt - should re-run a query when the observable value has emitted' , ( done : any ) => {
283272
284273 const subject = new Subject ( ) ;
285- const observable = FirebaseListFactory ( questionsPath , {
274+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
286275 query : {
287276 orderByKey : true ,
288277 startAt : subject
@@ -295,7 +284,7 @@ describe('FirebaseListFactory', () => {
295284 it ( 'endAt - should re-run a query when the observable value has emitted' , ( done : any ) => {
296285
297286 const subject = new Subject ( ) ;
298- const observable = FirebaseListFactory ( questionsPath , {
287+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
299288 query : {
300289 orderByKey : true ,
301290 endAt : subject
@@ -318,7 +307,7 @@ describe('FirebaseListFactory', () => {
318307 it ( 'equalTo - should re-run a query when the observable value has emitted' , ( done : any ) => {
319308
320309 const subject = new Subject ( ) ;
321- const observable = FirebaseListFactory ( questionsPath , {
310+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
322311 query : {
323312 orderByKey : true ,
324313 equalTo : subject
@@ -331,7 +320,7 @@ describe('FirebaseListFactory', () => {
331320 it ( 'startAt - should re-run a query when the observable value has emitted' , ( done : any ) => {
332321
333322 const subject = new Subject ( ) ;
334- const observable = FirebaseListFactory ( questionsPath , {
323+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
335324 query : {
336325 orderByKey : true ,
337326 startAt : subject
@@ -344,7 +333,7 @@ describe('FirebaseListFactory', () => {
344333 it ( 'endAt - should re-run a query when the observable value has emitted' , ( done : any ) => {
345334
346335 const subject = new Subject ( ) ;
347- const observable = FirebaseListFactory ( questionsPath , {
336+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
348337 query : {
349338 orderByKey : true ,
350339 endAt : subject
@@ -360,7 +349,7 @@ describe('FirebaseListFactory', () => {
360349 describe ( 'shape' , ( ) => {
361350
362351 it ( 'should have a a FirebaseListObservable shape when queried' , ( ) => {
363- const observable = FirebaseListFactory ( questionsPath , {
352+ const observable = FirebaseListFactory ( app . database ( ) . ref ( questionsPath ) , {
364353 query : {
365354 orderByChild : 'height' ,
366355 equalTo : '1'
@@ -390,9 +379,9 @@ describe('FirebaseListFactory', () => {
390379 val1 = { key : 'key1' } ;
391380 val2 = { key : 'key2' } ;
392381 val3 = { key : 'key3' } ;
393- firebase . database ( ) . ref ( ) . remove ( done ) ;
394- questions = FirebaseListFactory ( `questions` ) ;
395- questionsSnapshotted = FirebaseListFactory ( `questionssnapshot` , { preserveSnapshot : true } ) ;
382+ app . database ( ) . ref ( ) . remove ( done ) ;
383+ questions = FirebaseListFactory ( app . database ( ) . ref ( `questions` ) ) ;
384+ questionsSnapshotted = FirebaseListFactory ( app . database ( ) . ref ( `questionssnapshot` ) , { preserveSnapshot : true } ) ;
396385 ref = questions . $ref ;
397386 refSnapshotted = questionsSnapshotted . $ref ;
398387 } ) ;
@@ -588,7 +577,7 @@ describe('FirebaseListFactory', () => {
588577
589578
590579 it ( 'should call off on all events when disposed' , ( done : any ) => {
591- const questionRef = firebase . database ( ) . ref ( ) . child ( 'questions' ) ;
580+ const questionRef = app . database ( ) . ref ( ) . child ( 'questions' ) ;
592581 let firebaseSpy = spyOn ( questionRef , 'off' ) . and . callThrough ( ) ;
593582 subscription = FirebaseListFactory ( questionRef ) . subscribe ( _ => {
594583 expect ( firebaseSpy ) . not . toHaveBeenCalled ( ) ;
@@ -694,7 +683,7 @@ describe('FirebaseListFactory', () => {
694683 } )
695684 . run ( ( ) => {
696685 // Creating a new observable so that the current zone is captured.
697- subscription = FirebaseListFactory ( `questions` )
686+ subscription = FirebaseListFactory ( app . database ( ) . ref ( `questions` ) )
698687 . filter ( d => d
699688 . map ( v => v . $value )
700689 . indexOf ( 'in-the-zone' ) > - 1 )
@@ -757,15 +746,15 @@ describe('FirebaseListFactory', () => {
757746 } )
758747 . then ( ( ) => {
759748
760- let query1 = FirebaseListFactory ( `questions` , {
749+ let query1 = FirebaseListFactory ( app . database ( ) . ref ( `questions` ) , {
761750 query : {
762751 orderByChild : 'data' ,
763752 startAt : { value : 0 }
764753 }
765754 } ) ;
766755 let promise1 = toPromise . call ( take . call ( query1 , 1 ) ) ;
767756
768- let query2 = FirebaseListFactory ( `questions` , {
757+ let query2 = FirebaseListFactory ( app . database ( ) . ref ( `questions` ) , {
769758 query : {
770759 orderByChild : 'data' ,
771760 startAt : { value : 0 , key : 'val2' }
@@ -795,15 +784,15 @@ describe('FirebaseListFactory', () => {
795784 } )
796785 . then ( ( ) => {
797786
798- let query1 = FirebaseListFactory ( `questions` , {
787+ let query1 = FirebaseListFactory ( app . database ( ) . ref ( `questions` ) , {
799788 query : {
800789 orderByChild : 'data' ,
801790 equalTo : { value : 0 }
802791 }
803792 } ) ;
804793 let promise1 = toPromise . call ( take . call ( query1 , 1 ) ) ;
805794
806- let query2 = FirebaseListFactory ( `questions` , {
795+ let query2 = FirebaseListFactory ( app . database ( ) . ref ( `questions` ) , {
807796 query : {
808797 orderByChild : 'data' ,
809798 equalTo : { value : 0 , key : 'val2' }
@@ -833,15 +822,15 @@ describe('FirebaseListFactory', () => {
833822 } )
834823 . then ( ( ) => {
835824
836- let query1 = FirebaseListFactory ( `questions` , {
825+ let query1 = FirebaseListFactory ( app . database ( ) . ref ( `questions` ) , {
837826 query : {
838827 orderByChild : 'data' ,
839828 endAt : { value : 0 }
840829 }
841830 } ) ;
842831 let promise1 = toPromise . call ( take . call ( query1 , 1 ) ) ;
843832
844- let query2 = FirebaseListFactory ( `questions` , {
833+ let query2 = FirebaseListFactory ( app . database ( ) . ref ( `questions` ) , {
845834 query : {
846835 orderByChild : 'data' ,
847836 endAt : { value : 0 , key : 'val2' }
@@ -871,7 +860,7 @@ describe('FirebaseListFactory', () => {
871860 . then ( ( ) => {
872861
873862 let subject = new Subject < boolean > ( ) ;
874- let query = FirebaseListFactory ( `questions` , {
863+ let query = FirebaseListFactory ( app . database ( ) . ref ( `questions` ) , {
875864 query : {
876865 orderByChild : 'even' ,
877866 equalTo : subject
0 commit comments