0
でレスポンスエラーのためにすべてのパラメータを解決できません:私はこれを実行するとは、私は私のテストでは、このコードを持っているジャスミンテスト
import {
beforeEach, beforeEachProviders,
describe, xdescribe,
expect, it, xit,
async, inject
} from '@angular/core/testing';
import { UserService } from './user.service';
import { Http, ConnectionBackend, Response, Headers, RequestOptions } from '@angular/http';
import { Observable } from 'rxjs/Observable';
import { LocalStorage, SessionStorage, WEB_STORAGE_PROVIDERS } from 'h5webstorage';
beforeEachProviders(() => [
UserService, Http, Response, Observable, ConnectionBackend, LocalStorage, Headers, RequestOptions
]);
describe('Service: UserService',() => {
it('testtest', inject([UserService], (service) => {
expect('test').toEqual('test');
}));
});
は、私は次のエラーを取得する:
Error: Cannot resolve all parameters for 'Response'(?). Make sure that all the parameters are decorated with Inject or have valid type annotations and that 'Response' is decorated with Injectable.
があるためinproperの本ですテストの依存性注入? ジャスミンテストで適切な依存性注入を行うにはどうすればよいですか?
ありがとう、これはトリック、メモ:これは角度RC4のです。 –
'RC4 @ stijn26はどうですか? 'provide'は' @ angular/core/testing'のメンバーではありません。これは動作していません。 –
'@ angular/core'からインポート{提供}します。 –