How to test API service using Karma with HttpTestingController

I am trying to get how to test my ApiService using HttpTestingController with Promise. Now my unit tests look as below: import { TestBed, getTestBed } from ‘@angular/core/testing’; import { HttpClientTestingModule, HttpTestingController } from ‘@angular/common/http/testing’; import { ApiService } from ‘./api.service’; import { faker } from ‘faker’; describe(‘ApiService’, () => { let injector: TestBed; let…

Details

How to convert Angular/Typescript string with date format of ‘M/d/yyyy’ to Java Date format?

I’m getting an error of “TypeError: params.title.split is not a function” When my date field pass to the rest-api is in the form of ’11/30/2019′(‘M/d/yyyy’), however when I changed the format into “2019-11-30T16:00:00.000+0000” (ISO format), it works fine. I’m using Reactive forms in Angular and the data we’re pass through formarray

Details