diff --git a/tests/GP_Temperature/CharsXMLList.test.ts b/tests/GP_Temperature/CharsXMLList.test.ts index 8c68060587a0f70798d5381abcc52249f092453c..b3596640d63e361f6545f37476656d98c59e98ad 100644 --- a/tests/GP_Temperature/CharsXMLList.test.ts +++ b/tests/GP_Temperature/CharsXMLList.test.ts @@ -3,10 +3,8 @@ * @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"; +import { select } from "../util"; +import { DCCDocument } from "../../src"; const base = "//dcc:quantity[@refType='test_charsXMLList']"; const xpath = { diff --git a/tests/GP_Temperature/noQuantity.test.ts b/tests/GP_Temperature/noQuantity.test.ts index 4f701bf6dcb1b8a8d6cb60525ced4059d1874402..6ccaf68ceb458767ad63ed38a821316fed6ab040 100644 --- a/tests/GP_Temperature/noQuantity.test.ts +++ b/tests/GP_Temperature/noQuantity.test.ts @@ -3,23 +3,21 @@ * @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"; +import { select } from "../util"; +import { DCCDocument } from "../../src"; -const base = "//dcc:quantity[@refType='test_noQuantity']"; +const base = "//dcc:quantity[@refType='test_noQuantity']/dcc:noQuantity"; const xpath = { noQuantity: { - name: `string(${base}/dcc:noQuantity/dcc:name)`, - content: `string(${base}/dcc:noQuantity/dcc:content)`, + name: `string(${base}/dcc:name)`, + content: `string(${base}/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)`, + fileName: `string(${base}/dcc:file/dcc:fileName)`, + mimeType: `string(${base}/dcc:file/dcc:mimeType)`, + dataBase64: `string(${base}/dcc:file/dcc:dataBase64)`, }, formula: { - latex: `string(${base}/dcc:noQuantity/dcc:formula/dcc:latex)`, + latex: `string(${base}/dcc:formula/dcc:latex)`, }, }, }; @@ -35,15 +33,19 @@ describe("noQuantity", () => { 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 latex formula from XML", () => { expect(result.data.quantity[0].noQuantity.formula[0].latex._text).toBe(select(xpath.noQuantity.formula.latex, dom)); }); diff --git a/tests/resources/example.xml b/tests/resources/example.xml index e972f64177d46de5d4b51939ca34b4a3676a2459..e4dec5e45f21e40157ddca30566c678fe10d8116 100644 --- a/tests/resources/example.xml +++ b/tests/resources/example.xml @@ -1,5 +1,5 @@ <?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.1.2/dcc.xsd" schemaVersion="3.1.2"> +<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>