@@ -3,7 +3,7 @@ import { FirebaseApp, FirebaseAppConfig, AngularFireModule } from 'angularfire2'
3
3
import { AngularFireDatabase , AngularFireDatabaseModule , listChanges } from 'angularfire2/database' ;
4
4
import { TestBed , inject } from '@angular/core/testing' ;
5
5
import { COMMON_CONFIG } from '../test-config' ;
6
- import 'rxjs/add/operator/skip ' ;
6
+ import { skip , take } from 'rxjs/operators ' ;
7
7
8
8
// generate random string to test fidelity of naming
9
9
const rando = ( ) => ( Math . random ( ) + 1 ) . toString ( 36 ) . substring ( 7 ) ;
@@ -46,7 +46,7 @@ describe('listChanges', () => {
46
46
it ( 'should stream value at first' , ( done ) => {
47
47
const someRef = ref ( rando ( ) ) ;
48
48
const obs = listChanges ( someRef , [ 'child_added' ] ) ;
49
- const sub = obs . take ( 1 ) . subscribe ( changes => {
49
+ const sub = obs . pipe ( take ( 1 ) ) . subscribe ( changes => {
50
50
const data = changes . map ( change => change . payload . val ( ) ) ;
51
51
expect ( data ) . toEqual ( items ) ;
52
52
} ) . add ( done ) ;
@@ -56,7 +56,7 @@ describe('listChanges', () => {
56
56
it ( 'should process a new child_added event' , done => {
57
57
const aref = ref ( rando ( ) ) ;
58
58
const obs = listChanges ( aref , [ 'child_added' ] ) ;
59
- const sub = obs . skip ( 1 ) . take ( 1 ) . subscribe ( changes => {
59
+ const sub = obs . pipe ( skip ( 1 ) , take ( 1 ) ) . subscribe ( changes => {
60
60
const data = changes . map ( change => change . payload . val ( ) ) ;
61
61
expect ( data [ 3 ] ) . toEqual ( { name : 'anotha one' } ) ;
62
62
} ) . add ( done ) ;
@@ -67,7 +67,7 @@ describe('listChanges', () => {
67
67
it ( 'should stream in order events' , ( done ) => {
68
68
const aref = ref ( rando ( ) ) ;
69
69
const obs = listChanges ( aref . orderByChild ( 'name' ) , [ 'child_added' ] ) ;
70
- const sub = obs . take ( 1 ) . subscribe ( changes => {
70
+ const sub = obs . pipe ( take ( 1 ) ) . subscribe ( changes => {
71
71
const names = changes . map ( change => change . payload . val ( ) . name ) ;
72
72
expect ( names [ 0 ] ) . toEqual ( 'one' ) ;
73
73
expect ( names [ 1 ] ) . toEqual ( 'two' ) ;
@@ -79,7 +79,7 @@ describe('listChanges', () => {
79
79
it ( 'should stream in order events w/child_added' , ( done ) => {
80
80
const aref = ref ( rando ( ) ) ;
81
81
const obs = listChanges ( aref . orderByChild ( 'name' ) , [ 'child_added' ] ) ;
82
- const sub = obs . skip ( 1 ) . take ( 1 ) . subscribe ( changes => {
82
+ const sub = obs . pipe ( skip ( 1 ) , take ( 1 ) ) . subscribe ( changes => {
83
83
const names = changes . map ( change => change . payload . val ( ) . name ) ;
84
84
expect ( names [ 0 ] ) . toEqual ( 'anotha one' ) ;
85
85
expect ( names [ 1 ] ) . toEqual ( 'one' ) ;
@@ -93,7 +93,7 @@ describe('listChanges', () => {
93
93
it ( 'should stream events filtering' , ( done ) => {
94
94
const aref = ref ( rando ( ) ) ;
95
95
const obs = listChanges ( aref . orderByChild ( 'name' ) . equalTo ( 'zero' ) , [ 'child_added' ] ) ;
96
- obs . skip ( 1 ) . take ( 1 ) . subscribe ( changes => {
96
+ obs . pipe ( skip ( 1 ) , take ( 1 ) ) . subscribe ( changes => {
97
97
const names = changes . map ( change => change . payload . val ( ) . name ) ;
98
98
expect ( names [ 0 ] ) . toEqual ( 'zero' ) ;
99
99
expect ( names [ 1 ] ) . toEqual ( 'zero' ) ;
@@ -105,7 +105,7 @@ describe('listChanges', () => {
105
105
it ( 'should process a new child_removed event' , done => {
106
106
const aref = ref ( rando ( ) ) ;
107
107
const obs = listChanges ( aref , [ 'child_added' , 'child_removed' ] ) ;
108
- const sub = obs . skip ( 1 ) . take ( 1 ) . subscribe ( changes => {
108
+ const sub = obs . pipe ( skip ( 1 ) , take ( 1 ) ) . subscribe ( changes => {
109
109
const data = changes . map ( change => change . payload . val ( ) ) ;
110
110
expect ( data . length ) . toEqual ( items . length - 1 ) ;
111
111
} ) . add ( done ) ;
@@ -118,7 +118,7 @@ describe('listChanges', () => {
118
118
it ( 'should process a new child_changed event' , ( done ) => {
119
119
const aref = ref ( rando ( ) ) ;
120
120
const obs = listChanges ( aref , [ 'child_added' , 'child_changed' ] )
121
- const sub = obs . skip ( 1 ) . take ( 1 ) . subscribe ( changes => {
121
+ const sub = obs . pipe ( skip ( 1 ) , take ( 1 ) ) . subscribe ( changes => {
122
122
const data = changes . map ( change => change . payload . val ( ) ) ;
123
123
expect ( data [ 1 ] . name ) . toEqual ( 'lol' ) ;
124
124
} ) . add ( done ) ;
@@ -131,7 +131,7 @@ describe('listChanges', () => {
131
131
it ( 'should process a new child_moved event' , ( done ) => {
132
132
const aref = ref ( rando ( ) ) ;
133
133
const obs = listChanges ( aref , [ 'child_added' , 'child_moved' ] )
134
- const sub = obs . skip ( 1 ) . take ( 1 ) . subscribe ( changes => {
134
+ const sub = obs . pipe ( skip ( 1 ) , take ( 1 ) ) . subscribe ( changes => {
135
135
const data = changes . map ( change => change . payload . val ( ) ) ;
136
136
// We moved the first item to the last item, so we check that
137
137
// the new result is now the last result
0 commit comments