From e1b1f6d743d67e20d7aa06229e92b08ad844d849 Mon Sep 17 00:00:00 2001 From: Gabriel De Los Rios Date: Sat, 20 Dec 2025 23:41:31 -0300 Subject: [PATCH] test: add test case for findById --- src/app/services/contact.service.spec.ts | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/src/app/services/contact.service.spec.ts b/src/app/services/contact.service.spec.ts index f452d52..40437aa 100644 --- a/src/app/services/contact.service.spec.ts +++ b/src/app/services/contact.service.spec.ts @@ -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();