Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve unit test coverage for OpenMRS Mediator #142

Closed
1 of 29 tasks
witash opened this issue Oct 10, 2024 · 1 comment
Closed
1 of 29 tasks

Improve unit test coverage for OpenMRS Mediator #142

witash opened this issue Oct 10, 2024 · 1 comment
Assignees
Labels
Testing Type: Improvement Make something better

Comments

@witash
Copy link
Contributor

witash commented Oct 10, 2024

Improve unit test coverage for openmrs

-----------------------------|---------|----------|---------|---------|---------------------------------------------------------------------------
File                         | % Stmts | % Branch | % Funcs | % Lines | Uncovered Line #s                                                         
-----------------------------|---------|----------|---------|---------|---------------------------------------------------------------------------
All files                    |   71.78 |    66.25 |    62.5 |   71.78 |
 controllers                 |   67.46 |    66.66 |      75 |   67.46 |
  cht.ts                     |      50 |    33.33 |   66.66 |      50 | 21-22,28-51,58-59,61-63,73-82
  service-request.ts         |     100 |      100 |     100 |     100 |
 controllers/tests           |     100 |      100 |     100 |     100 |
  utils.ts                   |     100 |      100 |     100 |     100 |
 mappers                     |   62.78 |    27.77 |   55.55 |   62.78 |
  cht.ts                     |   62.35 |       25 |      60 |   62.35 | 106-146,148-170
  openmrs.ts                 |   63.54 |    33.33 |      50 |   63.54 | 40-64,70-78,87
 middlewares                 |     100 |      100 |     100 |     100 |
  index.ts                   |     100 |      100 |     100 |     100 |
 middlewares/schemas         |     100 |      100 |     100 |     100 |
  encounter.ts               |     100 |      100 |     100 |     100 |
  endpoint.ts                |     100 |      100 |     100 |     100 |
  organization.ts            |     100 |      100 |     100 |     100 |
  patient.ts                 |     100 |      100 |     100 |     100 |
  service-request.ts         |     100 |      100 |     100 |     100 |
 middlewares/schemas/tests   |     100 |      100 |     100 |     100 |
  cht-request-factories.ts   |     100 |      100 |     100 |     100 |
  fhir-resource-factories.ts |     100 |      100 |     100 |     100 |
 routes                      |     100 |      100 |     100 |     100 |
  cht.ts                     |     100 |      100 |     100 |     100 |
  encounter.ts               |     100 |      100 |     100 |     100 |
  endpoint.ts                |     100 |      100 |     100 |     100 |
  organization.ts            |     100 |      100 |     100 |     100 |
  patient.ts                 |     100 |      100 |     100 |     100 |
  service-request.ts         |     100 |      100 |     100 |     100 |
 utils                       |    62.1 |    64.42 |   61.22 |    62.1 |
  cht.ts                     |   53.08 |    28.57 |   54.54 |   53.08 | 38-40,59-85,88-103,116-119,127-129,132-141,143-152,160-162
  fhir.ts                    |   71.61 |    71.11 |   77.77 |   71.61 | 112-114,140-147,177-179,182-210,212-223,225-236
  openhim.ts                 |     100 |      100 |     100 |     100 |
  openmrs.ts                 |   26.38 |      100 |       0 |   26.38 | 17-22,24-52,54-62,64-72
  openmrs_sync.ts            |   61.65 |    66.66 |   53.84 |   61.65 | 37-38,44-45,95-96,107-108,177-181,187-196,204-235,241-245,254-301,310-326
  request.ts                 |     100 |      100 |     100 |     100 |
  url.ts                     |     100 |      100 |     100 |     100 |
-----------------------------|---------|----------|---------|---------|---------------------------------------------------------------------------

src/controllers/cht.ts

  • updatePatientIds
  • createPatient where source id is specified
  • patient is not found
  • encounter w/ observations

src/mappers/cht.ts

  • observations (covered by encounter w/ observations)

src/mappers/openmrs.ts

  • visitNote
  • observations

src/utils/cht.ts

  • getPatientUUIDFromSourceId (covered by updatePatientsIds)
  • getLocation
  • createChtPatient (covered elsewhere, add specific test)
  • chtRecordFromObservations
  • queryCht
  • chtRecordsApi (error branch)

src/utils/fhir.ts

  • addId
  • error branches (createFhirPatient, createFhirResource)
  • getFhirResourceSince

src/utils/openmrs.ts

  • getOpenMRSPatientResource
  • getOpenMRSResourcesSince
  • createOpenMRSResource
  • updateOpenMRSResource

src/utils/openmrs_sync.ts

  • getResources (error branch)
  • compare (invalid date)
  • compare (error branch)
  • getPatient
  • getObservations
  • sendEncounterToOpenMRS
  • sendObservationToFhir
  • sendEncounterToFhir
  • syncEncounters
@andrablaj
Copy link
Member

Closed via #143

@github-project-automation github-project-automation bot moved this from In Progress to Done in Product Team Activities Oct 23, 2024
witash added a commit that referenced this issue Oct 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Testing Type: Improvement Make something better
Projects
No open projects
Status: Done
Development

No branches or pull requests

2 participants