diff --git a/tests/DCC/GP_Temperatur_v3.2.1_DCC/AdministrativeData.CoreDataType.test.ts b/tests/DCC/GP_Temperatur_v3.2.1_DCC/AdministrativeData.CoreDataType.test.ts index e271495c32673a3397df6b4b884c641f5d22c48c..7d9e8e73beb82673906041aa52e2f6d09e579fb2 100644 --- a/tests/DCC/GP_Temperatur_v3.2.1_DCC/AdministrativeData.CoreDataType.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.1_DCC/AdministrativeData.CoreDataType.test.ts @@ -6,13 +6,13 @@ import { select } from "../../util"; import { CoreDataType, DCCDocument } from "../../../src"; -const base = "/dcc:digitalCalibrationCertificate/dcc:administrativeData/dcc:coreData"; +const base = "/dcc:digitalCalibrationCertificate/dcc:administrativeData/dcc:coreData/dcc:reportAmendedSubstituted"; const xpath = { - coreData: { - reportAmendedSubstituted: { - typeOfChange: `string(${base}/dcc:reportAmendedSubstituted/dcc:typeOfChange)`, - replacedUniqueIdentifier: `string(${base}/dcc:reportAmendedSubstituted/dcc:replacedUniqueIdentifier)`, - }, + reportAmendedSubstituted: { + typeOfChange: `string(${base}/dcc:typeOfChange)`, + replacedUniqueIdentifier: `string(${base}/dcc:replacedUniqueIdentifier)`, + refType: `string(${base}//@refType)`, + id: `string(${base}//@id)`, }, }; @@ -25,12 +25,18 @@ describe("GP_Temperature_v3.2.1_DCC: CoreDataType", () => { }); test("should get correct reportAmendedSubstituted typeOfChange from XML", () => { - expect(coreData.reportAmendedSubstituted.typeOfChange._text).toBe(select(xpath.coreData.reportAmendedSubstituted.typeOfChange, dom)); + expect(coreData.reportAmendedSubstituted.typeOfChange._text).toBe(select(xpath.reportAmendedSubstituted.typeOfChange, dom)); }); test("should get correct reportAmendedSubstituted replacedUniqueIdentifier from XML", () => { - expect(coreData.reportAmendedSubstituted.replacedUniqueIdentifier._text).toBe( - select(xpath.coreData.reportAmendedSubstituted.replacedUniqueIdentifier, dom), - ); + expect(coreData.reportAmendedSubstituted.replacedUniqueIdentifier._text).toBe(select(xpath.reportAmendedSubstituted.replacedUniqueIdentifier, dom)); + }); + + test("should get correct reportAmendedSubstituted refType from XML", () => { + expect(coreData.reportAmendedSubstituted._attr.refType).toBe(select(xpath.reportAmendedSubstituted.refType, dom)); + }); + + test("should get correct reportAmendedSubstituted id from XML", () => { + expect(coreData.reportAmendedSubstituted._attr.id).toBe(select(xpath.reportAmendedSubstituted.id, dom)); }); }); diff --git a/tests/DCC/GP_Temperatur_v3.2.1_DCC/AdministrativeData.Items.Item.test.ts b/tests/DCC/GP_Temperatur_v3.2.1_DCC/AdministrativeData.Items.Item.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..08474c9c177e2324b0dca0593976d4098dfa24f6 --- /dev/null +++ b/tests/DCC/GP_Temperatur_v3.2.1_DCC/AdministrativeData.Items.Item.test.ts @@ -0,0 +1,21 @@ +/** + * @jest-environment ./tests/XMLEnvironment.ts + * @xml ./tests/resources/GP_Temperature_v3.2.1_DCC.xml + */ + +import { DCCDocument, ItemType } from "../../../src"; + +describe("GP_Temperature_v3.2.1_DCC: ItemType", () => { + let dcc: DCCDocument, item: ItemType, dom; + + beforeEach(() => { + ({ dcc, dom } = xmlEnv.recreateEnv()); + item = dcc.digitalCalibrationCertificate.administrativeData.items.item[0]; + }); + + test("should get item manufacturer null from XML", () => { + expect(item.manufacturer).toBeUndefined(); + }); + + /* TODO: setters */ +}); diff --git a/tests/resources/GP_Temperature_v3.2.1_DCC.xml b/tests/resources/GP_Temperature_v3.2.1_DCC.xml index 6e46ec62e3837903734f034f8c18defccf37d2e1..29db7ff3243471fbd9f06126154eeaca36b737de 100644 --- a/tests/resources/GP_Temperature_v3.2.1_DCC.xml +++ b/tests/resources/GP_Temperature_v3.2.1_DCC.xml @@ -55,7 +55,7 @@ <dcc:endPerformanceDate>1957-08-13</dcc:endPerformanceDate> <dcc:performanceLocation>laboratory</dcc:performanceLocation> <dcc:issueDate>2022-12-31</dcc:issueDate> - <dcc:reportAmendedSubstituted> + <dcc:reportAmendedSubstituted id="R2D2" refType="test_reportAmendedSubstituted"> <!-- TODO: refType und id hinzufügen --> <dcc:typeOfChange>amended</dcc:typeOfChange> <dcc:replacedUniqueIdentifier>GP_DCC_temperature_minimal_3.2.0_Complete</dcc:replacedUniqueIdentifier> </dcc:reportAmendedSubstituted> diff --git a/tests/resources/example.xml b/tests/resources/example.xml index e4dec5e45f21e40157ddca30566c678fe10d8116..f2e67bf394a180785836ea1e2f411a4420fb5aad 100644 --- a/tests/resources/example.xml +++ b/tests/resources/example.xml @@ -134,7 +134,7 @@ <dcc:statement refType="basic_validityRange"> <dcc:declaration> <dcc:content lang="de">Angabe des Temperaturbereichs, in dem kalibriert wurde:</dcc:content> - <dcc:content lang="de">Specification of the temperature range in which calibration was performed:</dcc:content> + <dcc:content lang="en">Specification of the temperature range in which calibration was performed:</dcc:content> </dcc:declaration> <dcc:data> <dcc:quantity refType="basic_validityRangeMin">