-2
The component I am testing uses Ant Design icons, and when running Karma tests with the 'npm run test' command the following error occurs:
An error was thrown in afterall error properties: Object({ longStack: 'Error: [@ant-design/icons-angular]:the icon user-o does not exist or is not Registered.
The spec code looks like this:
import { HttpClientModule } from '@angular/common/http';
import { FormsModule, ReactiveFormsModule } from '@angular/forms';
import { BetboxService } from './../services/betbox.service';
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { NgZorroAntdModule } from 'ng-zorro-antd';
import { LoginComponent } from './login.component';
describe('LoginComponent', () => {
let component: LoginComponent;
let fixture: ComponentFixture<LoginComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [ LoginComponent ],
imports: [
FormsModule,
ReactiveFormsModule,
NgZorroAntdModule,
HttpClientModule
],
providers: [
BetboxService
]
})
.compileComponents();
}));
beforeEach(() => {
fixture = TestBed.createComponent(LoginComponent);
component = fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});```