Skip to content
Snippets Groups Projects
Commit dabb4fe1 authored by Muhammed-Ali Demir's avatar Muhammed-Ali Demir :speech_balloon:
Browse files

test: added tests for reftype, id of reportAmendedSubstituted and item...

parent 297071e5
No related branches found
No related tags found
1 merge request!7test: added tests for reftype, id of reportAmendedSubstituted and item...
......@@ -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));
});
});
/**
* @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 */
});
......@@ -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>
......
......@@ -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">
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment