【发布时间】:2018-03-26 09:18:38
【问题描述】:
这是我的 spec.ts 文件。我被错误困住了:
错误:无法解析 RequestOptions 的所有参数:(?)
我还导入了所有必要的提供程序。谁能帮我解决这个错误?
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);
}));
});
【问题讨论】:
标签: angular unit-testing testing angular-cli karma-jasmine