55 * Use of this source code is governed by an MIT-style license that can be
66 * found in the LICENSE file at https://angular.io/license
77 */
8- import { Observable } from 'rxjs/Observable ' ;
9- import 'rxjs/add/operator/mergeMap ' ;
8+ import { of as observableOf } from 'rxjs/observable/of ' ;
9+ import { map , mergeMap } from 'rxjs/operators ' ;
1010import { CoreSchemaRegistry } from './registry' ;
1111
1212
@@ -31,12 +31,14 @@ describe('CoreSchemaRegistry', () => {
3131 } ,
3232 } ,
3333 } )
34- . mergeMap ( validator => validator ( data ) )
35- . map ( result => {
36- expect ( result . success ) . toBe ( true ) ;
37- expect ( data . obj . num ) . toBeUndefined ( ) ;
38- expect ( data . tslint ) . not . toBeUndefined ( ) ;
39- } )
34+ . pipe (
35+ mergeMap ( validator => validator ( data ) ) ,
36+ map ( result => {
37+ expect ( result . success ) . toBe ( true ) ;
38+ expect ( data . obj . num ) . toBeUndefined ( ) ;
39+ expect ( data . tslint ) . not . toBeUndefined ( ) ;
40+ } ) ,
41+ )
4042 . subscribe ( done , done . fail ) ;
4143 } ) ;
4244
@@ -61,11 +63,13 @@ describe('CoreSchemaRegistry', () => {
6163 } ,
6264 } ,
6365 } )
64- . mergeMap ( validator => validator ( data ) )
65- . map ( result => {
66- expect ( result . success ) . toBe ( true ) ;
67- expect ( data . obj . num ) . toBeUndefined ( ) ;
68- } )
66+ . pipe (
67+ mergeMap ( validator => validator ( data ) ) ,
68+ map ( result => {
69+ expect ( result . success ) . toBe ( true ) ;
70+ expect ( data . obj . num ) . toBeUndefined ( ) ;
71+ } ) ,
72+ )
6973 . subscribe ( ( ) => {
7074 isDone = true ;
7175 } , done . fail ) ;
@@ -93,10 +97,12 @@ describe('CoreSchemaRegistry', () => {
9397 str : { type : 'string' , format : 'is-hotdog' } ,
9498 } ,
9599 } )
96- . mergeMap ( validator => validator ( data ) )
97- . map ( result => {
98- expect ( result . success ) . toBe ( true ) ;
99- } )
100+ . pipe (
101+ mergeMap ( validator => validator ( data ) ) ,
102+ map ( result => {
103+ expect ( result . success ) . toBe ( true ) ;
104+ } ) ,
105+ )
100106 . subscribe ( done , done . fail ) ;
101107 } ) ;
102108
@@ -107,7 +113,7 @@ describe('CoreSchemaRegistry', () => {
107113 name : 'is-hotdog' ,
108114 formatter : {
109115 async : true ,
110- validate : ( str : string ) => Observable . of ( str === 'hotdog' ) ,
116+ validate : ( str : string ) => observableOf ( str === 'hotdog' ) ,
111117 } ,
112118 } ;
113119
@@ -120,10 +126,12 @@ describe('CoreSchemaRegistry', () => {
120126 str : { type : 'string' , format : 'is-hotdog' } ,
121127 } ,
122128 } )
123- . mergeMap ( validator => validator ( data ) )
124- . map ( result => {
125- expect ( result . success ) . toBe ( true ) ;
126- } )
129+ . pipe (
130+ mergeMap ( validator => validator ( data ) ) ,
131+ map ( result => {
132+ expect ( result . success ) . toBe ( true ) ;
133+ } ) ,
134+ )
127135 . subscribe ( done , done . fail ) ;
128136 } ) ;
129137
@@ -147,11 +155,13 @@ describe('CoreSchemaRegistry', () => {
147155 banana : { type : 'string' , format : 'is-hotdog' } ,
148156 } ,
149157 } )
150- . mergeMap ( validator => validator ( data ) )
151- . map ( result => {
152- expect ( result . success ) . toBe ( false ) ;
153- expect ( result . errors && result . errors [ 0 ] ) . toBe ( '.banana should match format "is-hotdog"' ) ;
154- } )
158+ . pipe (
159+ mergeMap ( validator => validator ( data ) ) ,
160+ map ( result => {
161+ expect ( result . success ) . toBe ( false ) ;
162+ expect ( result . errors && result . errors [ 0 ] ) . toBe ( '.banana should match format "is-hotdog"' ) ;
163+ } ) ,
164+ )
155165 . subscribe ( done , done . fail ) ;
156166 } ) ;
157167} ) ;
0 commit comments