@@ -6,11 +6,8 @@ import { AngularFirestoreCollection } from './collection';
66import { QueryFn } from '../interfaces' ;
77
88import { FirebaseApp as FBApp } from '@firebase/app-types' ;
9- import { Observable } from 'rxjs/Observable' ;
10- import { BehaviorSubject } from 'rxjs/BehaviorSubject' ;
11- import { of } from 'rxjs/observable/of' ;
12- import { Subscription } from 'rxjs/Subscription' ;
13- import 'rxjs/add/operator/skip' ;
9+ import { Observable , BehaviorSubject , Subscription } from 'rxjs' ;
10+ import { skip , take , switchMap } from 'rxjs/operators' ;
1411
1512import { TestBed , inject } from '@angular/core/testing' ;
1613import { COMMON_CONFIG } from '../test-config' ;
@@ -80,7 +77,7 @@ describe('AngularFirestoreCollection', () => {
8077 const { randomCollectionName, ref, stocks, names } = await collectionHarness ( afs , ITEMS ) ;
8178 const changes = stocks . valueChanges ( ) ;
8279 const sub = changes . subscribe ( ( ) => { } ) . add (
83- changes . take ( 1 ) . subscribe ( data => {
80+ changes . pipe ( take ( 1 ) ) . subscribe ( data => {
8481 expect ( data . length ) . toEqual ( ITEMS ) ;
8582 sub . unsubscribe ( ) ;
8683 } )
@@ -93,8 +90,8 @@ describe('AngularFirestoreCollection', () => {
9390 const ITEMS = 4 ;
9491 const { randomCollectionName, ref, stocks, names } = await collectionHarness ( afs , ITEMS ) ;
9592 const changes = stocks . valueChanges ( ) ;
96- changes . take ( 1 ) . subscribe ( ( ) => { } ) . add ( ( ) => {
97- const sub = changes . take ( 1 ) . subscribe ( data => {
93+ changes . pipe ( take ( 1 ) ) . subscribe ( ( ) => { } ) . add ( ( ) => {
94+ const sub = changes . pipe ( take ( 1 ) ) . subscribe ( data => {
9895 expect ( data . length ) . toEqual ( ITEMS ) ;
9996 } ) . add ( ( ) => {
10097 deleteThemAll ( names , ref ) . then ( done ) . catch ( done . fail ) ;
@@ -110,9 +107,9 @@ describe('AngularFirestoreCollection', () => {
110107 const randomCollectionName = randomName ( afs . firestore ) ;
111108 const ref = afs . firestore . collection ( `${ randomCollectionName } ` ) ;
112109 let names = await createRandomStocks ( afs . firestore , ref , ITEMS ) ;
113- const sub = pricefilter$ . switchMap ( price => {
110+ const sub = pricefilter$ . pipe ( switchMap ( price => {
114111 return afs . collection ( randomCollectionName , ref => price ? ref . where ( 'price' , '==' , price ) : ref ) . valueChanges ( )
115- } ) . subscribe ( data => {
112+ } ) ) . subscribe ( data => {
116113 count = count + 1 ;
117114 // the first time should all be 'added'
118115 if ( count === 1 ) {
@@ -161,7 +158,7 @@ describe('AngularFirestoreCollection', () => {
161158 const { randomCollectionName, ref, stocks, names } = await collectionHarness ( afs , ITEMS ) ;
162159 const changes = stocks . snapshotChanges ( ) ;
163160 const sub = changes . subscribe ( ( ) => { } ) . add (
164- changes . take ( 1 ) . subscribe ( data => {
161+ changes . pipe ( take ( 1 ) ) . subscribe ( data => {
165162 expect ( data . length ) . toEqual ( ITEMS ) ;
166163 sub . unsubscribe ( ) ;
167164 } )
@@ -174,8 +171,8 @@ describe('AngularFirestoreCollection', () => {
174171 const ITEMS = 4 ;
175172 const { randomCollectionName, ref, stocks, names } = await collectionHarness ( afs , ITEMS ) ;
176173 const changes = stocks . snapshotChanges ( ) ;
177- changes . take ( 1 ) . subscribe ( ( ) => { } ) . add ( ( ) => {
178- const sub = changes . take ( 1 ) . subscribe ( data => {
174+ changes . pipe ( take ( 1 ) ) . subscribe ( ( ) => { } ) . add ( ( ) => {
175+ const sub = changes . pipe ( take ( 1 ) ) . subscribe ( data => {
179176 expect ( data . length ) . toEqual ( ITEMS ) ;
180177 } ) . add ( ( ) => {
181178 deleteThemAll ( names , ref ) . then ( done ) . catch ( done . fail ) ;
@@ -214,7 +211,7 @@ describe('AngularFirestoreCollection', () => {
214211 const ITEMS = 10 ;
215212 const { randomCollectionName, ref, stocks, names } = await collectionHarness ( afs , ITEMS ) ;
216213
217- const sub = stocks . snapshotChanges ( [ 'modified' ] ) . skip ( 1 ) . subscribe ( data => {
214+ const sub = stocks . snapshotChanges ( [ 'modified' ] ) . pipe ( skip ( 1 ) ) . subscribe ( data => {
218215 sub . unsubscribe ( ) ;
219216 const change = data . filter ( x => x . payload . doc . id === names [ 0 ] ) [ 0 ] ;
220217 expect ( data . length ) . toEqual ( 1 ) ;
@@ -231,7 +228,7 @@ describe('AngularFirestoreCollection', () => {
231228 let { randomCollectionName, ref, stocks, names } = await collectionHarness ( afs , ITEMS ) ;
232229 const nextId = ref . doc ( 'a' ) . id ;
233230
234- const sub = stocks . snapshotChanges ( [ 'added' ] ) . skip ( 1 ) . subscribe ( data => {
231+ const sub = stocks . snapshotChanges ( [ 'added' ] ) . pipe ( skip ( 1 ) ) . subscribe ( data => {
235232 sub . unsubscribe ( ) ;
236233 const change = data . filter ( x => x . payload . doc . id === nextId ) [ 0 ] ;
237234 expect ( data . length ) . toEqual ( ITEMS + 1 ) ;
@@ -252,7 +249,7 @@ describe('AngularFirestoreCollection', () => {
252249 const nextId = ref . doc ( 'a' ) . id ;
253250 let count = 0 ;
254251
255- const sub = stocks . snapshotChanges ( [ 'added' , 'modified' ] ) . skip ( 1 ) . take ( 2 ) . subscribe ( data => {
252+ const sub = stocks . snapshotChanges ( [ 'added' , 'modified' ] ) . pipe ( skip ( 1 ) , take ( 2 ) ) . subscribe ( data => {
256253 count += 1 ;
257254 if ( count == 1 ) {
258255 const change = data . filter ( x => x . payload . doc . id === nextId ) [ 0 ] ;
@@ -279,7 +276,7 @@ describe('AngularFirestoreCollection', () => {
279276 const ITEMS = 10 ;
280277 const { randomCollectionName, ref, stocks, names } = await collectionHarness ( afs , ITEMS ) ;
281278
282- const sub = stocks . snapshotChanges ( [ 'added' , 'removed' ] ) . skip ( 1 ) . subscribe ( data => {
279+ const sub = stocks . snapshotChanges ( [ 'added' , 'removed' ] ) . pipe ( skip ( 1 ) ) . subscribe ( data => {
283280 sub . unsubscribe ( ) ;
284281 const change = data . filter ( x => x . payload . doc . id === names [ 0 ] ) ;
285282 expect ( data . length ) . toEqual ( ITEMS - 1 ) ;
@@ -339,7 +336,7 @@ describe('AngularFirestoreCollection', () => {
339336 const { randomCollectionName, ref, stocks, names } = await collectionHarness ( afs , ITEMS ) ;
340337 const changes = stocks . stateChanges ( ) ;
341338 const sub = changes . subscribe ( ( ) => { } ) . add (
342- changes . take ( 1 ) . subscribe ( data => {
339+ changes . pipe ( take ( 1 ) ) . subscribe ( data => {
343340 expect ( data . length ) . toEqual ( ITEMS ) ;
344341 sub . unsubscribe ( ) ;
345342 } )
@@ -352,8 +349,8 @@ describe('AngularFirestoreCollection', () => {
352349 const ITEMS = 4 ;
353350 const { randomCollectionName, ref, stocks, names } = await collectionHarness ( afs , ITEMS ) ;
354351 const changes = stocks . stateChanges ( ) ;
355- changes . take ( 1 ) . subscribe ( ( ) => { } ) . add ( ( ) => {
356- const sub = changes . take ( 1 ) . subscribe ( data => {
352+ changes . pipe ( take ( 1 ) ) . subscribe ( ( ) => { } ) . add ( ( ) => {
353+ const sub = changes . pipe ( take ( 1 ) ) . subscribe ( data => {
357354 expect ( data . length ) . toEqual ( ITEMS ) ;
358355 } ) . add ( ( ) => {
359356 deleteThemAll ( names , ref ) . then ( done ) . catch ( done . fail ) ;
@@ -383,7 +380,7 @@ describe('AngularFirestoreCollection', () => {
383380 let count = 0 ;
384381 let { randomCollectionName, ref, stocks, names } = await collectionHarness ( afs , ITEMS ) ;
385382
386- const sub = stocks . stateChanges ( [ 'added' ] ) . skip ( 1 ) . subscribe ( data => {
383+ const sub = stocks . stateChanges ( [ 'added' ] ) . pipe ( skip ( 1 ) ) . subscribe ( data => {
387384 sub . unsubscribe ( ) ;
388385 expect ( data . length ) . toEqual ( 1 ) ;
389386 expect ( data [ 0 ] . payload . doc . data ( ) . price ) . toEqual ( 2 ) ;
0 commit comments