Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit 3e00ec0

Browse files
NathanWalkervakrilov
authored and
vakrilov
committed
fix(Http): test issue with mocking http
1 parent 78d5d92 commit 3e00ec0

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

‎nativescript-angular/http/ns-http.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ export class NSXSRFStrategy {
1212

1313
@Injectable()
1414
export class NSHttp extends Http {
15-
constructor(backend: ConnectionBackend, defaultOptions: RequestOptions, private nsFileSystem: NSFileSystem) {
15+
constructor(backend: ConnectionBackend, defaultOptions: any, private nsFileSystem: NSFileSystem) {
1616
super(backend, defaultOptions);
1717
}
1818

‎tests/app/tests/http.ts‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import {
66
beforeEach,
77
beforeEachProviders
88
} from '@angular/core/testing';
9-
import {provide,ReflectiveInjector} from '@angular/core';
9+
import {ReflectiveInjector} from '@angular/core';
1010
import {BaseRequestOptions, ConnectionBackend, Http, HTTP_PROVIDERS, Response, ResponseOptions} from '@angular/http';
1111
import 'rxjs/add/operator/map';
1212
import {MockBackend} from '@angular/http/testing';
@@ -20,17 +20,17 @@ describe("Http", () => {
2020

2121
beforeEach(() => {
2222
let injector = ReflectiveInjector.resolveAndCreate([
23-
HTTP_PROVIDERS,
2423
BaseRequestOptions,
2524
MockBackend,
26-
provide(NSFileSystem, { useClass: NSFileSystemMock }),
27-
provide(Http, {
28-
useFactory: function (backend: ConnectionBackend, defaultOptions: BaseRequestOptions, nsFileSystem: NSFileSystem) {
29-
//HACK: cast backend to any to work around an angular typings problem
30-
return new NSHttp(<any>backend, <any>defaultOptions, nsFileSystem);
31-
},
32-
deps: [MockBackend, BaseRequestOptions, NSFileSystem]
33-
})
25+
{ provide: NSFileSystem, useClass: NSFileSystemMock },
26+
{
27+
provide: Http,
28+
useFactory: function (backend: ConnectionBackend, defaultOptions: BaseRequestOptions, nsFileSystem: NSFileSystem) {
29+
//HACK: cast backend to any to work around an angular typings problem
30+
return new NSHttp(<any>backend, defaultOptions, nsFileSystem);
31+
},
32+
deps: [MockBackend, BaseRequestOptions, NSFileSystem]
33+
}
3434
]);
3535

3636
backend = injector.get(MockBackend);

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /