Skip to content

Commit 83c1a2e

Browse files
vakrilovsis0k0
vakrilov
authored andcommitted
chore: migrated test porject to ng6+rxjs6
1 parent d85910c commit 83c1a2e

File tree

8 files changed

+38
-28
lines changed

8 files changed

+38
-28
lines changed

Diff for: tests/app/base.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { InjectionToken, OnInit, OnDestroy } from "@angular/core";
22
export const HOOKS_LOG = new InjectionToken("Hooks log");
3-
import { BehaviorSubject } from "rxjs/BehaviorSubject";
3+
import { BehaviorSubject } from "rxjs";
44

55
export class BaseComponent implements OnInit, OnDestroy {
66
protected name: string = "";

Diff for: tests/app/first.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import { Router, ActivatedRoute } from "@angular/router";
22
import { Component, Inject } from "@angular/core";
33
import { RouterExtensions } from "nativescript-angular/router";
44
import { HOOKS_LOG, BaseComponent } from "./base.component";
5-
import { BehaviorSubject } from "rxjs/BehaviorSubject";
5+
import { BehaviorSubject } from "rxjs";
66

77
@Component({
88
selector: "first-comp",

Diff for: tests/app/main.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ import { NavigationApp } from "./snippets/navigation/router-outlet";
3131

3232
import { rendererTraceCategory, routerTraceCategory } from "nativescript-angular/trace";
3333

34-
import { BehaviorSubject } from "rxjs/BehaviorSubject";
34+
import { BehaviorSubject } from "rxjs";
3535

3636
import { GridLayout, ItemSpec } from "tns-core-modules/ui/layouts/grid-layout/grid-layout";
3737

Diff for: tests/app/second.component.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ import { Component, Inject, OnInit } from "@angular/core";
33
import { Location } from "@angular/common";
44
import { RouterExtensions } from "nativescript-angular/router";
55
import { HOOKS_LOG, BaseComponent } from "./base.component";
6-
import { BehaviorSubject } from "rxjs/BehaviorSubject";
6+
import { BehaviorSubject } from "rxjs";
77

88
@Component({
99
selector: "second-comp",

Diff for: tests/app/snippets/navigation/route-params.ts

+4-4
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ class MyComponent {
1212

1313
// >> router-params-page-route
1414
import { PageRoute } from "nativescript-angular/router";
15-
import "rxjs/add/operator/switchMap";
15+
import { switchMap } from "rxjs/operators";
1616

1717
class MyPageComponent {
1818
id: number;
1919
constructor(private pageRoute: PageRoute) {
2020
// use switchMap to get the latest activatedRoute instance
21-
this.pageRoute.activatedRoute
22-
.switchMap(activatedRoute => activatedRoute.params)
23-
.forEach((params) => { this.id = +params["id"]; });
21+
this.pageRoute.activatedRoute.pipe(
22+
switchMap(activatedRoute => activatedRoute.params)
23+
).forEach((params) => { this.id = +params["id"]; });
2424
}
2525
}
2626
// << router-params-page-route

Diff for: tests/app/tests/http.ts

+16-6
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
} from "@angular/core/testing";
77
import { ReflectiveInjector, Injectable } from "@angular/core";
88
import { Request, BaseRequestOptions, ConnectionBackend, Http, Response, ResponseOptions } from "@angular/http";
9-
import "rxjs/add/operator/map";
9+
import { map } from "rxjs/operators";
1010
import { MockBackend } from "@angular/http/testing";
1111
import { NSHttp } from "nativescript-angular/http/ns-http";
1212
import { 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
});

Diff for: tests/app/tests/snippets.ts

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import { assert } from "./test-config";
33

44
import { NavigationEnd, NavigationStart } from "@angular/router";
5-
import { Subscription } from "rxjs/Subscription";
5+
import { Subscription } from "rxjs";
66
import { TestApp, bootstrapTestApp, destroyTestApp } from "./test-app";
77

88
import { GestureComponent } from "../snippets/gestures.component";

Diff for: tests/package.json

+13-13
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
"nativescript": {
33
"id": "org.nativescript.ngtests",
44
"tns-ios": {
5-
"version": "next"
5+
"version": "4.0.2-2018-04-13-01"
66
},
77
"tns-android": {
8-
"version": "next"
8+
"version": "4.1.0-2018.4.16.8"
99
}
1010
},
1111
"name": "ngtests",
@@ -26,18 +26,18 @@
2626
],
2727
"homepage": "http://nativescript.org",
2828
"dependencies": {
29-
"@angular/animations": "~5.2.0",
30-
"@angular/common": "~5.2.0",
31-
"@angular/compiler": "~5.2.0",
32-
"@angular/core": "~5.2.0",
33-
"@angular/forms": "~5.2.0",
34-
"@angular/http": "~5.2.0",
35-
"@angular/platform-browser": "~5.2.0",
36-
"@angular/platform-browser-dynamic": "~5.2.0",
37-
"@angular/router": "~5.2.0",
29+
"@angular/animations": "~6.0.0-rc.3",
30+
"@angular/common": "~6.0.0-rc.3",
31+
"@angular/compiler": "~6.0.0-rc.3",
32+
"@angular/core": "~6.0.0-rc.3",
33+
"@angular/forms": "~6.0.0-rc.3",
34+
"@angular/http": "~6.0.0-rc.3",
35+
"@angular/platform-browser": "~6.0.0-rc.3",
36+
"@angular/platform-browser-dynamic": "~6.0.0-rc.3",
37+
"@angular/router": "~6.0.0-rc.3",
3838
"nativescript-angular": "../nativescript-angular",
3939
"nativescript-unit-test-runner": "^0.3.4",
40-
"rxjs": "^5.5.0",
40+
"rxjs": "~6.0.0-rc.1",
4141
"tns-core-modules": "next",
4242
"zone.js": "^0.8.4"
4343
},
@@ -66,7 +66,7 @@
6666
"socket.io-client": "1.4.8",
6767
"tslib": "^1.7.1",
6868
"tslint": "^4.5.1",
69-
"typescript": "~2.6.2",
69+
"typescript": "~2.7.2",
7070
"mocha": "~3.5.0"
7171
},
7272
"scripts": {

0 commit comments

Comments
 (0)