Skip to content

Commit

Permalink
fix: get services (#15)
Browse files Browse the repository at this point in the history
Signed-off-by: Kathurima Kimathi <[email protected]>
  • Loading branch information
KathurimaKimathi authored Oct 12, 2023
1 parent 53f6d6e commit 3a810d8
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion healthcrm.go
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ func (h *HealthCRMLib) UpdateFacility(ctx context.Context, id string, updatePayl

// GetFacilityServices fetches services associated with facility
func (h *HealthCRMLib) GetFacilityServices(ctx context.Context, facilityID string) (*FacilityServicePage, error) {
path := "/v1/facilities/facilities/"
path := "/v1/facilities/services/"
queryParams := make(map[string]string)
queryParams["facility"] = facilityID
response, err := h.client.MakeRequest(ctx, http.MethodGet, path, queryParams, nil)
Expand Down
4 changes: 2 additions & 2 deletions healthcrm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -500,7 +500,7 @@ func TestHealthCRMLib_GetFacilityServices(t *testing.T) {
for _, tt := range tests {
t.Run(tt.name, func(t *testing.T) {
if tt.name == "Happy case: get facility services" {
path := fmt.Sprintf("%s/v1/facilities/facilities/", BaseURL)
path := fmt.Sprintf("%s/v1/facilities/services/", BaseURL)
httpmock.RegisterResponder(http.MethodGet, path, func(r *http.Request) (*http.Response, error) {
resp := &FacilityServicePage{
Results: []FacilityService{
Expand All @@ -516,7 +516,7 @@ func TestHealthCRMLib_GetFacilityServices(t *testing.T) {
})
}
if tt.name == "Sad case: unable to get facility services" {
path := fmt.Sprintf("%s/v1/facilities/facilities/", BaseURL)
path := fmt.Sprintf("%s/v1/facilities/services/", BaseURL)
httpmock.RegisterResponder(http.MethodGet, path, func(r *http.Request) (*http.Response, error) {
return httpmock.NewJsonResponse(http.StatusBadGateway, nil)
})
Expand Down

0 comments on commit 3a810d8

Please sign in to comment.