@arkhn/fhir.ts
Advanced tools
Comparing version 3.4.3 to 3.4.4
@@ -235,3 +235,3 @@ "use strict"; | ||
throw new Error("attribute " + this.path + " has no extension child"); | ||
var ext = new Attribute(__assign(__assign({}, childExtension.definition), { type: [{ code: 'Extension', extension: [{ valueUrl: definitionId }] }] })); | ||
var ext = new Attribute(__assign(__assign({}, childExtension.definition), { type: [{ code: definitionId }] })); | ||
return childExtension.addItem(index, ext); | ||
@@ -238,0 +238,0 @@ }; |
{ | ||
"name": "@arkhn/fhir.ts", | ||
"private": false, | ||
"version": "3.4.3", | ||
"version": "3.4.4", | ||
"description": "Open source typescript library providing FHIR utilities", | ||
@@ -6,0 +6,0 @@ "main": "lib/index.js", |
@@ -115,2 +115,18 @@ import { Attribute } from 'attribute' | ||
const observationExtensionDefinition: AttributeDefinition = { | ||
id: 'Observation.extension', | ||
path: 'Observation.extension', | ||
definition: 'Extenson blabla', | ||
min: 0, | ||
max: '*', | ||
base: { | ||
path: 'DomainResource.extension', | ||
}, | ||
type: [ | ||
{ | ||
code: 'Extension', | ||
}, | ||
], | ||
} | ||
describe('Attribute', () => { | ||
@@ -328,2 +344,13 @@ it('builds from an AttributeDefinition', () => { | ||
describe('addExtension', () => { | ||
it('adds an extension with the extension id', () => { | ||
const parent = new Attribute(observationCodeDefinition) | ||
const child = new Attribute(observationExtensionDefinition) | ||
parent.addChild(child) | ||
const extensionNode = parent.addExtension('extension-custom-id') | ||
expect(extensionNode.types).toEqual(['extension-custom-id']) | ||
}) | ||
}) | ||
describe('addItem', () => { | ||
@@ -330,0 +357,0 @@ it('throws if the attribute is not an array', () => { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
546523
6937