lundi 26 mars 2018

Angular4 Testing Karma - Error: Can't resolve all parameters for RequestOptions: (?)

This is my spec.ts file. I'm stuck with the error Error: Can't resolve all parameters for RequestOptions: (?). I have imported all the providers necessary also. Can anyone please help me resolve this error? Thanks in advance.

import { async, ComponentFixture, TestBed, inject } from '@angular/core/testing';
import { ResetPasswordComponent } from './reset-password.component';
import { ConfigService } from './../config-service.service';
import {Http, Headers, ConnectionBackend, RequestOptions} from '@angular/http';

describe('ResetPasswordComponent', () => {
  // let component: ResetPasswordComponent;
  // let fixture: ComponentFixture<ResetPasswordComponent>;

   beforeEach(() => {
    TestBed.configureTestingModule({
      providers: [ResetPasswordComponent, ConfigService, Http, ConnectionBackend, RequestOptions]
    });
  });

  // beforeEach(async(() => {
  //   TestBed.configureTestingModule({
  //     declarations: [ ResetPasswordComponent ]
  //   })
  //   .compileComponents();
  // }));

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

  // it('should create', () => {
  //   expect(component).toBeTruthy();
  // });

  it('should create', () => {
    expect('holaa').toBe('holaa');
  });

  it('Is Password Change Function Working', inject([ResetPasswordComponent], (reset:ResetPasswordComponent) => {
    expect(reset.simplyAFunction()).toBe(true);
  }));
});

Aucun commentaire:

Enregistrer un commentaire