-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore(#123): Enhance Automated Tests for CHT & OpenMRS Endpoints in M…
…ediator (#152) Co-authored-by: Tom Wier <thomas@medic.org> Co-authored-by: Maria Lorena Rodriguez Viruel <marialorenarodriguezviruel@mbp-de-maria.lan> Co-authored-by: Maria Lorena Rodriguez Viruel <marialorenarodriguezviruel@MacBook-Pro-de-Maria.local>
- Loading branch information
1 parent
cc3d748
commit fef3183
Showing
6 changed files
with
240 additions
and
57 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,67 @@ | ||
import { randomUUID } from 'crypto'; | ||
import { Factory } from 'rosie'; | ||
|
||
export const OpenMRSPatientFactory = new Factory() | ||
.option('placeId') | ||
.attr('resourceType', 'Patient') | ||
.attr('id', () => randomUUID()) | ||
.attr('meta', () => ({ | ||
versionId: '2', | ||
lastUpdated: new Date().toISOString(), | ||
source: 'cht#rjEgeBRWROBrChB7' | ||
})) | ||
.attr('text', () => ({ | ||
status: 'generated', | ||
div: '<div xmlns="http://www.w3.org/1999/xhtml"><div class="hapiHeaderText">OpenMRS <b>PATIENT </b></div><table class="hapiPropertyTable"><tbody><tr><td>Identifier</td><td>52802</td></tr><tr><td>Date of birth</td><td><span>06 June 1980</span></td></tr></tbody></table></div>' | ||
})) | ||
.attr('identifier', () => [ | ||
{ | ||
id: randomUUID(), | ||
use: 'official', | ||
type: { text: 'CHT Patient ID' }, | ||
value: Math.floor(Math.random() * 100000).toString() | ||
}, | ||
{ | ||
id: randomUUID(), | ||
use: 'secondary', | ||
type: { text: 'CHT Document ID' }, | ||
value: randomUUID() | ||
}, | ||
{ | ||
id: randomUUID(), | ||
use: 'secondary', | ||
type: { text: 'OpenMRS Patient UUID' }, | ||
value: randomUUID() | ||
} | ||
]) | ||
.attr('name', () => [ | ||
{ | ||
id: randomUUID(), | ||
family: 'Patient', | ||
given: ['OpenMRS'] | ||
} | ||
]) | ||
.attr('telecom', () => [ | ||
{ | ||
id: randomUUID(), | ||
value: '+2548277217095' | ||
} | ||
]) | ||
.attr('gender', 'male') | ||
.attr('birthDate', '1980-06-06') | ||
.attr('address', ['placeId'], (placeId) => [ | ||
{ | ||
id: randomUUID(), | ||
line: ['123 Main St'], | ||
city: 'Nairobi', | ||
country: 'Kenya', | ||
extension: [{ | ||
extension: [ | ||
{ | ||
url: 'http://fhir.openmrs.org/ext/address#address4', | ||
valueString: `FCHV Area [${placeId}]` | ||
} | ||
] | ||
}] | ||
} | ||
]); |
Oops, something went wrong.