Skip to content
Snippets Groups Projects
Commit b695cb4b authored by Moritz Jordan's avatar Moritz Jordan
Browse files

test: added GP_Temperature_Complete_DCC.xml and tests for noQuantity

parent 273bb61e
No related branches found
No related tags found
3 merge requests!10Refactor Test Resources,!6Adaptations for new DCC V3.2.1,!5Add tests
Pipeline #18570 passed
This commit is part of merge request !5. Comments created here will be created in the context of that merge request.
/**
* @jest-environment ./tests/XMLEnvironment.ts
* @xml ./tests/resources/GP_Temperature_Complete_DCC.xml
*/
import * as fc from "fast-check";
import { indexOf, select, toTextArr, toTextContentArr } from "../util";
import { CoreDataType, DCCDocument, DCCXMLElement } from "../../src";
import { string_ISO639_1 } from "../Arbitraries";
const base = "//dcc:quantity[@refType='test_charsXMLList']";
const xpath = {
charsXMLList: `string(${base}/dcc:charsXMLList)`,
};
describe("CharsXMLList", () => {
let dcc: DCCDocument, dom, result;
beforeEach(async () => {
({ dcc, dom } = await xmlEnv.recreateEnv());
result = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].results.result[0];
});
test("should get correct charsXMLList from XML", () => {
expect(result.data.quantity[1].charsXMLList._text).toBe(select(xpath.charsXMLList, dom));
});
});
/**
* @jest-environment ./tests/XMLEnvironment.ts
* @xml ./tests/resources/GP_Temperature_Complete_DCC.xml
*/
import * as fc from "fast-check";
import { indexOf, select, toTextArr, toTextContentArr } from "../util";
import { CoreDataType, DCCDocument, DCCXMLElement } from "../../src";
import { string_ISO639_1 } from "../Arbitraries";
const base = "//dcc:quantity[@refType='test_noQuantity']";
const xpath = {
noQuantity: {
name: `string(${base}/dcc:noQuantity/dcc:name)`,
content: `string(${base}/dcc:noQuantity/dcc:content)`,
file: {
fileName: `string(${base}/dcc:noQuantity/dcc:file/dcc:fileName)`,
mimeType: `string(${base}/dcc:noQuantity/dcc:file/dcc:mimeType)`,
dataBase64: `string(${base}/dcc:noQuantity/dcc:file/dcc:dataBase64)`,
},
},
};
describe("noQuantity", () => {
let dcc: DCCDocument, dom, result;
beforeEach(async () => {
({ dcc, dom } = await xmlEnv.recreateEnv());
result = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].results.result[0];
});
test("should get correct name from XML", () => {
expect(result.data.quantity[0].noQuantity.name._text).toBe(select(xpath.noQuantity.name, dom));
});
test("should get correct content from XML", () => {
expect(result.data.quantity[0].noQuantity.content[0]._text).toBe(select(xpath.noQuantity.content, dom));
});
test("should get correct fileName from XML", () => {
expect(result.data.quantity[0].noQuantity.file[0].fileName._text).toBe(select(xpath.noQuantity.file.fileName, dom));
});
test("should get correct mimeType from XML", () => {
expect(result.data.quantity[0].noQuantity.file[0].mimeType._text).toBe(select(xpath.noQuantity.file.mimeType, dom));
});
test("should get correct dataBase64 from XML", () => {
expect(result.data.quantity[0].noQuantity.file[0].dataBase64._text).toBe(select(xpath.noQuantity.file.dataBase64, dom));
});
});
<?xml version="1.0" encoding="UTF-8"?>
<dcc:digitalCalibrationCertificate xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:dcc="https://ptb.de/dcc" xmlns:si="https://ptb.de/si" xsi:schemaLocation="https://ptb.de/dcc https://ptb.de/dcc/v3.2.0/dcc.xsd" schemaVersion="3.2.0">
<dcc:administrativeData>
<dcc:dccSoftware>
<dcc:software>
<dcc:name>
<dcc:content>Notepad++ (32-bit)</dcc:content>
</dcc:name>
<dcc:release>v8.2</dcc:release>
</dcc:software>
</dcc:dccSoftware>
<dcc:coreData>
<dcc:countryCodeISO3166_1>DE</dcc:countryCodeISO3166_1>
<dcc:usedLangCodeISO639_1>en</dcc:usedLangCodeISO639_1>
<dcc:mandatoryLangCodeISO639_1>en</dcc:mandatoryLangCodeISO639_1>
<dcc:uniqueIdentifier>GP_DCC_temperature_simplified_1.1.1</dcc:uniqueIdentifier>
<dcc:beginPerformanceDate>1957-08-13</dcc:beginPerformanceDate>
<dcc:endPerformanceDate>1957-08-13</dcc:endPerformanceDate>
<dcc:performanceLocation>laboratory</dcc:performanceLocation>
</dcc:coreData>
<dcc:items>
<dcc:item>
<dcc:name>
<dcc:content lang="en">Temperature sensor</dcc:content>
</dcc:name>
<dcc:manufacturer>
<dcc:name>
<dcc:content>String</dcc:content>
</dcc:name>
</dcc:manufacturer>
<dcc:identifications>
<dcc:identification>
<dcc:issuer>manufacturer</dcc:issuer>
<dcc:value>string-manufacturer-item</dcc:value>
</dcc:identification>
</dcc:identifications>
</dcc:item>
</dcc:items>
<dcc:calibrationLaboratory>
<dcc:contact>
<dcc:name>
<dcc:content>Kalibrierfirma GmbH</dcc:content>
</dcc:name>
<dcc:location>
<dcc:city>Musterstadt</dcc:city>
</dcc:location>
</dcc:contact>
</dcc:calibrationLaboratory>
<dcc:respPersons>
<dcc:respPerson>
<dcc:person>
<dcc:name>
<dcc:content>Michaela Musterfrau</dcc:content>
</dcc:name>
</dcc:person>
</dcc:respPerson>
</dcc:respPersons>
<dcc:customer>
<dcc:name>
<dcc:content>Kunde GmbH</dcc:content>
</dcc:name>
<dcc:eMail>info@kunde.xx</dcc:eMail>
<dcc:location>
<dcc:city>Musterstadt</dcc:city>
<dcc:countryCode>DE</dcc:countryCode>
<dcc:postCode>00900</dcc:postCode>
<dcc:further>
<dcc:content lang="de">Kunden Nr. 1024418</dcc:content>
<dcc:content lang="en">Customer ID no. 1024418</dcc:content>
</dcc:further>
</dcc:location>
</dcc:customer>
</dcc:administrativeData>
<dcc:measurementResults>
<dcc:measurementResult>
<dcc:name>
<dcc:content lang="en">Measurement results</dcc:content>
</dcc:name>
<dcc:results>
<dcc:result refType="gp_measuringResult1">
<dcc:name>
<dcc:content lang="en">Measuring results</dcc:content>
</dcc:name>
<dcc:data>
<dcc:quantity refType="test_noQuantity">
<dcc:noQuantity>
<dcc:name>Example name</dcc:name>
<dcc:content>Example text</dcc:content>
<dcc:file refType="examplePicture">
<dcc:fileName>examplePicture.png</dcc:fileName>
<dcc:mimeType>image/png</dcc:mimeType>
<dcc:dataBase64>iVBORw0KGgoAAAANSUhEUgAAABQAAAAUCAYAAACNiR0NAAAEDmlDQ1BrQ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tP6BWGhAlhL3p2N6sTjRdduwbHsG9kq32sgBepc+xurLPW4T9URpYGJ3ym4+8zA05u44QjST8ZIoVtu3qE7fWmdn5LPdqvgcZz8Ww8BWJ8X3w0PhQ/wnCDGd+LvlHs8dRy6bLLDuKMaZ20tZrqisPJ5ONiCq8yKhYM5cCgKOu66Lsc0aYOtZdo5QCwezI4wm9J/v0X23mlZXOfBjj8Jzv3WrY5D+CsA9D7aMs2gGfjve8ArD6mePZSeCfEYt8CONWDw8FXTxrPqx/r9Vt4biXeANh8vV7/+/16ffMD1N8AuKD/A/8leAvFY9bLAAAAOGVYSWZNTQAqAAAACAABh2kABAAAAAEAAAAaAAAAAAACoAIABAAAAAEAAAAUoAMABAAAAAEAAAAUAAAAAJEV0scAAAAtSURBVDgRY2RgYPgPxFQDTFQzCWrQqIGUh+hoGI6GIRkhMJpsyAg0NC0jMAwBzu4BJ2FWhpgAAAAASUVORK5CYII=</dcc:dataBase64>
</dcc:file>
</dcc:noQuantity>
</dcc:quantity>
<dcc:quantity refType="test_charsXMLList">
<dcc:charsXMLList>A B C D E F</dcc:charsXMLList>
</dcc:quantity>
<dcc:quantity refType="test_constant">
<si:constant>
<si:label>exampleLabel</si:label>
<si:value>306.248</si:value>
<si:unit>\kelvin</si:unit>
<si:dateTime>1111-11-11T11:11:11</si:dateTime>
</si:constant>
</dcc:quantity>
<dcc:quantity refType="test_real">
<si:real>
<si:label>exampleLabel</si:label>
<si:value>306.248</si:value>
<si:unit>\kelvin</si:unit>
<si:dateTime>1111-11-11T11:11:11</si:dateTime>
</si:real>
</dcc:quantity>
<dcc:quantity refType="test_realListXMLList">
<si:realListXMLList>
<si:labelXMLList>exampleLabel</si:labelXMLList>
<si:valueXMLList>306.248 373.121 448.253 523.319 593.154</si:valueXMLList>
<si:unitXMLList>\kelvin</si:unitXMLList>
<si:dateTimeXMLList>1111-11-11T11:11:11 1111-11-11T11:11:12 1111-11-11T11:11:13 1111-11-11T11:11:14 1111-11-11T11:11:15</si:dateTimeXMLList>
</si:realListXMLList>
</dcc:quantity>
<dcc:quantity refType="test_hybridConstant">
<si:hybrid>
<si:constant>
<si:label>exampleLabel</si:label>
<si:value>306.248</si:value>
<si:unit>\kelvin</si:unit>
<si:dateTime>1111-11-11T11:11:11</si:dateTime>
</si:constant>
<si:constant>
<si:label>exampleLabel</si:label>
<si:value>33.098</si:value>
<si:unit>\degreecelsius</si:unit>
<si:dateTime>1111-11-11T11:11:11</si:dateTime>
</si:constant>
</si:hybrid>
</dcc:quantity>
<dcc:quantity refType="test_hybridReal">
<si:hybrid>
<si:real>
<si:value>306.248</si:value>
<si:unit>\kelvin</si:unit>
</si:real>
<si:real>
<si:value>33.098</si:value>
<si:unit>\degreecelsius</si:unit>
</si:real>
</si:hybrid>
</dcc:quantity>
<dcc:quantity refType="test_hybridRealListXMLList">
<si:hybrid>
<si:realListXMLList>
<si:valueXMLList>306.248 373.121 448.253 523.319 593.154</si:valueXMLList>
<si:unitXMLList>\kelvin</si:unitXMLList>
</si:realListXMLList>
<si:realListXMLList>
<si:valueXMLList>33.098 99.971 175.103 250.169 320.004</si:valueXMLList>
<si:unitXMLList>\degreecelsius</si:unitXMLList>
</si:realListXMLList>
</si:hybrid>
</dcc:quantity>
</dcc:data>
</dcc:result>
</dcc:results>
</dcc:measurementResult>
</dcc:measurementResults>
</dcc:digitalCalibrationCertificate>
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment