-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
(fix) O3-4218: Auto generated identifiers with manual entry are not s…
…aved (#1386)
- Loading branch information
1 parent
f512ae8
commit 8f389a7
Showing
2 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
33 changes: 33 additions & 0 deletions
33
.../esm-patient-registration-app/src/patient-registration/patient-registration-utils.test.ts
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,33 @@ | ||
import { filterOutUndefinedPatientIdentifiers } from './patient-registration-utils'; | ||
|
||
describe('filterOutUndefinedPatientIdentifiers', () => { | ||
const getIdentifiers = (autoGeneration = true, manualEntryEnabled = false) => ({ | ||
OpenMRSId: { | ||
autoGeneration: autoGeneration, | ||
identifierName: 'OpenMRS ID', | ||
identifierTypeUuid: '05a29f94-c0ed-11e2-94be-8c13b969e334', | ||
identifierValue: undefined, | ||
initialValue: '100GEJ', | ||
preferred: true, | ||
required: true, | ||
selectedSource: { | ||
uuid: '01af8526-cea4-4175-aa90-340acb411771', | ||
name: 'Generator for OpenMRS ID', | ||
autoGenerationOption: { | ||
manualEntryEnabled: manualEntryEnabled, | ||
automaticGenerationEnabled: autoGeneration, | ||
}, | ||
}, | ||
}, | ||
}); | ||
|
||
it('should fitler out undefined identifiers', () => { | ||
const filteredIdentifiers = filterOutUndefinedPatientIdentifiers(getIdentifiers()); | ||
expect(filteredIdentifiers.OpenMRSId).not.toBeDefined(); | ||
}); | ||
|
||
it('should retain auto-generated identifiers with manual entry', () => { | ||
const filteredIdentifiers = filterOutUndefinedPatientIdentifiers(getIdentifiers(true, true)); | ||
expect(filteredIdentifiers.OpenMRSId).toBeDefined(); | ||
}); | ||
}); |
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