UNPKG

fume-fhir-converter

Version:

FHIR-Utilized Mapping Engine - Community

63 lines 2.37 kB
"use strict"; /** * © Copyright Outburn Ltd. 2022-2024 All Rights Reserved * Project name: FUME-COMMUNITY */ Object.defineProperty(exports, "__esModule", { value: true }); const globals_1 = require("@jest/globals"); const cache_1 = require("../cache"); const getCurrElement_1 = require("./getCurrElement"); describe('getCurrElement', () => { beforeEach(() => { (0, cache_1.initCache)(); }); (0, globals_1.test)('Returns undefined if type is empty', async () => { const currTypeStructureDefinition = { snapshot: { element: [ { id: 'Patient.id', path: 'Patient.id' } ] } }; const res = (0, getCurrElement_1.getCurrElement)(currTypeStructureDefinition, 'id', 1, ['identifier', 'system'], 'Patient'); expect(res).toBe(undefined); }); // TODO: this fails globals_1.test.skip('Returns undefined if snapshot is empty', async () => { const currTypeStructureDefinition = { type: 'Patient', snapshot: {} }; const res = (0, getCurrElement_1.getCurrElement)(currTypeStructureDefinition, 'id', 1, ['identifier', 'system'], 'Patient'); expect(res).toBe(undefined); }); (0, globals_1.test)('Returns undefined if structure elements are empty', async () => { const currTypeStructureDefinition = { type: 'Patient', snapshot: { element: [] } }; const res = (0, getCurrElement_1.getCurrElement)(currTypeStructureDefinition, 'id', 1, ['identifier', 'system'], 'Patient'); expect(res).toBe(undefined); }); (0, globals_1.test)('Finds element in structure if exists on top level', async () => { const currTypeStructureDefinition = { type: 'Patient', snapshot: { element: [ { id: 'Patient.id', path: 'Patient.id' } ] } }; const res = (0, getCurrElement_1.getCurrElement)(currTypeStructureDefinition, 'id', 1, ['identifier', 'system'], 'Patient'); expect(res.id).toBe('Patient.id'); }); }); //# sourceMappingURL=getCurrElement.test.js.map