I'm trying to test a basic service but it seens like the httpClient is not sending the request to my local api even it says that passes to the test
describe('MyService', () => {
beforeEach(() => {
TestBed.configureTestingModule({
imports:[
//HttpClientTestingModule,
HttpClientModule,
TranslateModule.forRoot(),
RouterTestingModule.withRoutes([])
],
providers:
[
MyService
]
});
});
it('should be return 1', inject([HttpClient,MyService],
(httpClient: HttpClient, myService: MyService) => {
myService.getById(parameter).subscribe((myModel: MyModel)=>{
expect(myModel.id).toBe(1);
});
}));
});
Aucun commentaire:
Enregistrer un commentaire