feat: add CPONE patient registration endpoint
This commit is contained in:
@@ -103,6 +103,36 @@ func TestRegisterLabValidPayloadAndResponseParity(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegisterLabUsesConfiguredDepartmentID(t *testing.T) {
|
||||
repo := &fakeLabRegistrationRepository{outcome: repository.LabRegistrationOutcome{
|
||||
HTTPStatus: http.StatusCreated,
|
||||
Success: true,
|
||||
Status: "registered",
|
||||
Message: "Registrasi laboratorium berhasil disimpan",
|
||||
}}
|
||||
handler := Handler{labRepo: repo, departmentID: "MED-PNJ-LAB"}
|
||||
body := `{
|
||||
"medrec_id":"00001234",
|
||||
"departemen_id":"DIABAIKAN",
|
||||
"dokter_id":"DR01",
|
||||
"dokter_pengirim_id":"DR02",
|
||||
"jenis_pasien_id":"0",
|
||||
"periode_tarif_id":10,
|
||||
"diagnosa_kerja":"Pemeriksaan laboratorium"
|
||||
}`
|
||||
|
||||
request := httptest.NewRequest(http.MethodPost, "/api/cpone/patients/lab-registration", strings.NewReader(body))
|
||||
recorder := httptest.NewRecorder()
|
||||
handler.RegisterLab(recorder, request)
|
||||
|
||||
if recorder.Code != http.StatusCreated {
|
||||
t.Fatalf("status = %d; body=%s", recorder.Code, recorder.Body.String())
|
||||
}
|
||||
if repo.params.DepartmentID != "MED-PNJ-LAB" {
|
||||
t.Fatalf("department ID = %q, want %q", repo.params.DepartmentID, "MED-PNJ-LAB")
|
||||
}
|
||||
}
|
||||
|
||||
func TestRegisterLabCompanyPayload(t *testing.T) {
|
||||
repo := &fakeLabRegistrationRepository{outcome: repository.LabRegistrationOutcome{
|
||||
HTTPStatus: http.StatusCreated,
|
||||
|
||||
Reference in New Issue
Block a user