Topic: mdb-completer error by ng test
Damian Gemza staff answered 7 years ago
duong do answered 7 years ago
Hi Damian,
This error is just occur when I run unittest (ng test). I can use "mdb-completer" in my component and it works very well.
After import CompleterData, CompleterService, LocalData, RemoteData, I got another issue:
"Can't resolve all parameters for RemoteData: (?)."
Do you have any idea?
Regards,
Duong
Here is my unittest file (it's hard to read, sorry.):
import { async, ComponentFixture, TestBed } from '@angular/core/testing';
import { FormsModule } from '@angular/forms';
import { TranslateModule, TranslateLoader } from '@ngx-translate/core';
import { PersonCreateComponent } from './person-create.component';
import { HttpLoaderFactory } from '../../core/i18n/i18n.component';
import { HttpClient, HttpClientModule } from '@angular/common/http';
import { NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA } from '@angular/core';
import { ConfigService } from '../../core/config/config.service';
import { PersonCreateService } from './person-create.service';
import { IsZipcodeDirective } from '../../shared/validation/input.directive';
import { CompleterService, CompleterData, LocalData, RemoteData } from 'ng-mdb-pro/pro/autocomplete';
import { DatePipe } from '@angular/common';
describe('PersonCreateComponent', () => {
letcomponent:PersonCreateComponent;
letfixture:ComponentFixture<PersonCreateComponent>;
beforeEach(async(() => {
TestBed.configureTestingModule({
declarations: [
PersonCreateComponent,
IsZipcodeDirective,
],
imports: [
FormsModule,
TranslateModule.forRoot({
loader: {
provide:TranslateLoader,
useFactory:HttpLoaderFactory,
deps: [HttpClient]
}
}),
HttpClientModule,
],
schemas: [NO_ERRORS_SCHEMA, CUSTOM_ELEMENTS_SCHEMA],
providers: [
ConfigService,
CompleterService,
LocalData,
RemoteData,
PersonCreateService,
]
})
.compileComponents();
}));
beforeEach(() => {
fixture=TestBed.createComponent(PersonCreateComponent);
component=fixture.componentInstance;
fixture.detectChanges();
});
it('should create', () => {
expect(component).toBeTruthy();
});
});
Damian Gemza staff commented 7 years ago
Could you provide me your code? Or even, if it possible, whole project without node modules directory? If you could share project, please send it to d.gemza@mdbootstrap.com I need to know, in which way do you use our MDB Completer component. Best Regards, DamianClosed
This topic is closed.
FREE CONSULTATION
Hire our experts to build a dedicated project. We'll analyze your business requirements, for free.
Closed
- User: Free
- Premium support: No
- Technology: MDB Angular
- MDB Version: -
- Device: -
- Browser: -
- OS: -
- Provided sample code: No
- Provided link: No