Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/angular/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Angular 2 Jasmine错误:无法解析NgRedux的所有参数_Angular_Jasmine_Redux - Fatal编程技术网

Angular 2 Jasmine错误:无法解析NgRedux的所有参数

Angular 2 Jasmine错误:无法解析NgRedux的所有参数,angular,jasmine,redux,Angular,Jasmine,Redux,我正在使用ngRedux和angular 2 我正在尝试测试一个使用ngRedux的简单组件: 我得到的错误如下 Failed: Can't resolve all parameters for NgRedux: (?). 有人能帮我弄清楚需要输入哪些参数吗?删除提供程序:[NgRedux],因为如果您已经在使用NgReduxModule,则不需要将NgRedux添加到提供程序中。完成!!现在我遇到另一个错误:_this._store为空我不熟悉Redux,但我认为您需要模拟this.ngRe

我正在使用ngRedux和angular 2

我正在尝试测试一个使用ngRedux的简单组件:

我得到的错误如下

Failed: Can't resolve all parameters for NgRedux: (?).

有人能帮我弄清楚需要输入哪些参数吗?

删除提供程序:[NgRedux],因为如果您已经在使用NgReduxModule,则不需要将NgRedux添加到提供程序中。

完成!!现在我遇到另一个错误:_this._store为空我不熟悉Redux,但我认为您需要模拟this.ngRedux.getState以返回mockstore。
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NgRedux, select, NgReduxModule } from 'ng2-redux';
import { ProfileDetailsComponent } from './profile-details.component';
import { CustomerProfileModel, rootReducer } from '../common/customerProfileReducer';

describe('ProfileDetailsComponent', () => {
  let component: ProfileDetailsComponent;
  let fixture: ComponentFixture<ProfileDetailsComponent>;
  let ngRedux: NgRedux<CustomerProfileModel>;

  beforeEach(async(() => {
    TestBed.configureTestingModule({
      declarations: [ProfileDetailsComponent],
      providers: [NgRedux],
      imports:[NgReduxModule]
    })
      .compileComponents();

  }));

  beforeEach(() => {
    fixture = TestBed.createComponent(ProfileDetailsComponent);
    component = fixture.componentInstance;
    fixture.detectChanges();
  });

  it('should create', () => {
    expect(component).toBeTruthy();
  });
});
export interface CustomerProfileModel {
    customerData: {
        ....
    };
}

export const CUSTPROFILE_INITIAL_STATE: CustomerProfileModel = {
    customerData: {
        ....
    }
};

export function rootReducer(state: CustomerProfileModel, action) {
    switch (action.type) {
        case 'GET_CUSTOMER_PROFILE_SUCCESS':
          return { customerData: action.customerData };
    }
    return state;
}
Failed: Can't resolve all parameters for NgRedux: (?).