66} from "@angular/core/testing" ;
77import { ReflectiveInjector , Injectable } from "@angular/core" ;
88import { Request , BaseRequestOptions , ConnectionBackend , Http , Response , ResponseOptions } from "@angular/http" ;
9- import "rxjs/add/operator/map " ;
9+ import { map } from "rxjs/operators " ;
1010import { MockBackend } from "@angular/http/testing" ;
1111import { NSHttp } from "nativescript-angular/http/ns-http" ;
1212import { NSFileSystem } from "nativescript-angular/file-system/ns-file-system" ;
@@ -62,14 +62,18 @@ describe("Http", () => {
6262 } ) ;
6363
6464 it ( "should work with local files prefixed with '~'" , ( ) => {
65- http . get ( "~/test.json" ) . map ( res => res . json ( ) ) . subscribe ( ( response : any ) => {
65+ http . get ( "~/test.json" ) . pipe (
66+ map ( res => res . json ( ) )
67+ ) . subscribe ( ( response : any ) => {
6668 assert . strictEqual ( 3 , response . length ) ;
6769 assert . strictEqual ( "Alex" , response [ 0 ] . name ) ;
6870 } ) ;
6971 } ) ;
7072
7173 it ( "request method should work with local files prefixed with '~'" , ( ) => {
72- http . request ( "~/test.json" ) . map ( res => res . json ( ) ) . subscribe ( ( response : any ) => {
74+ http . request ( "~/test.json" ) . pipe (
75+ map ( res => res . json ( ) )
76+ ) . subscribe ( ( response : any ) => {
7377 assert . strictEqual ( 3 , response . length ) ;
7478 assert . strictEqual ( "Alex" , response [ 0 ] . name ) ;
7579 } ) ;
@@ -81,14 +85,18 @@ describe("Http", () => {
8185 method : 'GET' ,
8286 url
8387 } ) ;
84- http . request ( req ) . map ( res => res . json ( ) ) . subscribe ( ( response : any ) => {
88+ http . request ( req ) . pipe (
89+ map ( res => res . json ( ) )
90+ ) . subscribe ( ( response : any ) => {
8591 assert . strictEqual ( 3 , response . length ) ;
8692 assert . strictEqual ( "Alex" , response [ 0 ] . name ) ;
8793 } ) ;
8894 } ) ;
8995
9096 it ( "should work with local files prefixed with '/'" , ( ) => {
91- http . get ( "/test.json" ) . map ( res => res . json ( ) ) . subscribe ( ( response : any ) => {
97+ http . get ( "/test.json" ) . pipe (
98+ map ( res => res . json ( ) )
99+ ) . subscribe ( ( response : any ) => {
92100 assert . strictEqual ( 3 , response . length ) ;
93101 assert . strictEqual ( "Panayot" , response [ 2 ] . name ) ;
94102 } ) ;
@@ -97,7 +105,9 @@ describe("Http", () => {
97105 it ( "should work with remote files" , ( ) => {
98106 let connection : any ;
99107 backend . connections . subscribe ( ( c : any ) => connection = c ) ;
100- http . get ( "http://www.nativescript.org/test.json" ) . map ( res => res . json ( ) ) . subscribe ( ( response : any ) => {
108+ http . get ( "http://www.nativescript.org/test.json" ) . pipe (
109+ map ( res => res . json ( ) )
110+ ) . subscribe ( ( response : any ) => {
101111 assert . strictEqual ( 3 , response . length ) ;
102112 assert . strictEqual ( "Rosen" , response [ 1 ] . name ) ;
103113 } ) ;
0 commit comments