test: add test case for findById
This commit is contained in:
@@ -43,6 +43,17 @@ describe('ContactService', () => {
|
||||
httpTestingController.verify();
|
||||
});
|
||||
|
||||
it('should GET contacts from the contacts ep with the given ID', () => {
|
||||
const ID_MOCK = 1;
|
||||
const url = `${endpointURL}/${ID_MOCK}`;
|
||||
service.findById(String(ID_MOCK)).subscribe();
|
||||
const req = httpTestingController.expectOne(url);
|
||||
expect(req.request.method).toEqual('GET');
|
||||
RES_MOCK.data = new ContactDTO(1, 'mock', 'mock', 'mock');
|
||||
req.flush(RES_MOCK);
|
||||
httpTestingController.verify();
|
||||
});
|
||||
|
||||
it('should POST contact to the contacts ep', () => {
|
||||
const CONTACT_MOCK = new ContactDTO(undefined, 'mock');
|
||||
service.save(CONTACT_MOCK).subscribe();
|
||||
|
||||
Reference in New Issue
Block a user