diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 9f2bc57a15cfd093a1ca8fddeff8c8c60f945c95..5a71494c94d819d9636940c819fef0be79efae9a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -50,14 +50,21 @@ unit_tests: needs: ["proxy"] script: - *yarn-install - - yarn run test:unit --ci + - yarn run test:unit --coverage + coverage: '/Lines\s*: \d+\.\d+/' cache: - <<: *yarn-cache artifacts: when: always + paths: + - junit.xml + - coverage/cobertura-coverage.xml reports: junit: - junit.xml + coverage_report: + coverage_format: cobertura + path: coverage/cobertura-coverage.xml # === Job: ESLint and Prettier === diff --git a/auto-imports.d.ts b/auto-imports.d.ts new file mode 100644 index 0000000000000000000000000000000000000000..cddd3f32f671f6d257a47b336e9fbb5b3609b819 --- /dev/null +++ b/auto-imports.d.ts @@ -0,0 +1,20 @@ +/* eslint-disable */ +/* prettier-ignore */ +// @ts-nocheck +// Generated by unplugin-auto-import +export {} +declare global { + const afterAll: typeof import('vitest')['afterAll'] + const afterEach: typeof import('vitest')['afterEach'] + const assert: typeof import('vitest')['assert'] + const beforeAll: typeof import('vitest')['beforeAll'] + const beforeEach: typeof import('vitest')['beforeEach'] + const chai: typeof import('vitest')['chai'] + const describe: typeof import('vitest')['describe'] + const expect: typeof import('vitest')['expect'] + const it: typeof import('vitest')['it'] + const suite: typeof import('vitest')['suite'] + const test: typeof import('vitest')['test'] + const vi: typeof import('vitest')['vi'] + const vitest: typeof import('vitest')['vitest'] +} diff --git a/jest.config.ts b/jest.config.ts deleted file mode 100644 index 1e5b8e453ae0be9aff65a9905646095639ac17d4..0000000000000000000000000000000000000000 --- a/jest.config.ts +++ /dev/null @@ -1,18 +0,0 @@ -import type { JestConfigWithTsJest } from "ts-jest"; - -const config: JestConfigWithTsJest = { - preset: "ts-jest", - testEnvironment: "node", - reporters: ["default", "jest-junit"], - coverageProvider: "v8", - transform: { - "^.+\\.m?[tj]sx?$": [ - "ts-jest", - { - tsconfig: "tests/tsconfig.json", - }, - ], - }, -}; - -export default config; diff --git a/package.json b/package.json index b2363486114e46fa4e10ce64ecfb60bc148769c0..cf2231e2354c1861fea2470c615b7b2ee87cfc6f 100644 --- a/package.json +++ b/package.json @@ -17,7 +17,7 @@ "test": "concurrently -m 1 \"npm:test:*\"", "test:lint": "eslint src --ext .ts", "test:prettier": "prettier \"src/**/*.ts\" --list-different", - "test:unit": "jest", + "test:unit": "vitest", "prepack": "npx rimraf lib && yarn run build", "prepublish": "yarn run test" }, @@ -25,24 +25,22 @@ "xml-js": "^1.6.11" }, "devDependencies": { - "@jest/globals": "^29.5.0", - "@types/jest": "^29.5.1", - "@types/node": "^18.16.2", - "@typescript-eslint/eslint-plugin": "^5.56.0", - "@typescript-eslint/parser": "^5.56.0", + "@types/node": "^18.16.18", + "@typescript-eslint/eslint-plugin": "^5.60.0", + "@typescript-eslint/parser": "^5.60.0", + "@vitest/coverage-istanbul": "^0.32.2", "concurrently": "^8.2.0", - "eslint": "^8.36.0", + "eslint": "^8.43.0", "eslint-config-prettier": "^8.8.0", - "fast-check": "^3.7.1", - "jest": "^29.5.0", - "jest-environment-node": "^29.5.0", - "jest-junit": "^16.0.0", - "jsdom": "^21.1.1", + "fast-check": "^3.10.0", + "jsdom": "^22.1.0", "lodash": "^4.17.21", - "prettier": "^2.8.6", - "ts-jest": "^29.1.0", + "prettier": "^2.8.8", "ts-node": "^10.9.1", - "typescript": "^4.9.5", + "typescript": "^5.1.3", + "unplugin-auto-import": "^0.16.4", + "vitest": "^0.32.2", + "vitest-environment-custom": "link:./tests/vitest-environment-custom", "xpath-ts": "^1.3.13" }, "publishConfig": { diff --git a/tests/DCC/AdministrativeData.CalibrationLaboratory.test.ts b/tests/DCC/AdministrativeData.CalibrationLaboratory.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..60139b17a40357eda8f3818097bd4bd56568b4f9 --- /dev/null +++ b/tests/DCC/AdministrativeData.CalibrationLaboratory.test.ts @@ -0,0 +1,79 @@ +/** + * @vitest-environment-options { "xmlPath": "./tests/resources/example.xml" } + */ + +import { select, toTextArr, toTextContentArr } from "../util"; +import { CalibrationLaboratoryType, DCCDocument } from "../../src"; + +const base = "/dcc:digitalCalibrationCertificate/dcc:administrativeData/dcc:calibrationLaboratory/dcc:contact"; +const xpath = { + name: `string(${base}/dcc:name/dcc:content)`, + eMail: `string(${base}/dcc:eMail)`, + phone: `string(${base}/dcc:phone)`, + fax: `string(${base}/dcc:fax)`, + location: { + city: `${base}/dcc:location/dcc:city`, + countryCode: `${base}/dcc:location/dcc:countryCode`, + postCode: `${base}/dcc:location/dcc:postCode`, + street: `${base}/dcc:location/dcc:street`, + streetNo: `${base}/dcc:location/dcc:streetNo`, + further: `${base}/dcc:location/dcc:further/dcc:content`, + }, +}; + +describe("CalibrationLaboratoryType", () => { + let dcc: DCCDocument, calibrationLaboratory: CalibrationLaboratoryType, dom; + + beforeEach(() => { + ({ dcc, dom } = recreateEnv()); + calibrationLaboratory = dcc.digitalCalibrationCertificate.administrativeData.calibrationLaboratory; + }); + + test("should get correct name from XML", () => { + expect(calibrationLaboratory.contact.name.content[0]._text).toBe(select(xpath.name, dom)); + }); + + test("should get correct eMail from XML", () => { + expect(calibrationLaboratory.contact.eMail._text).toBe(select(xpath.eMail, dom)); + }); + + test("should get correct phone from XML", () => { + expect(calibrationLaboratory.contact.phone._text).toBe(select(xpath.phone, dom)); + }); + + test("should get correct city from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.location.city, dom); + expect(toTextArr(calibrationLaboratory.contact.location.city)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct countryCode from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.location.countryCode, dom); + expect(toTextArr(calibrationLaboratory.contact.location.countryCode)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct postCode from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.location.postCode, dom); + expect(toTextArr(calibrationLaboratory.contact.location.postCode)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct street from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.location.street, dom); + expect(toTextArr(calibrationLaboratory.contact.location.street)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct streetNo from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.location.streetNo, dom); + expect(toTextArr(calibrationLaboratory.contact.location.streetNo)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct further element from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.location.further, dom); + expect(toTextArr(calibrationLaboratory.contact.location.further[0].content)).toEqual(toTextContentArr(expected)); + }); +}); diff --git a/tests/DCC/AdministrativeData.CoreDataType.test.ts b/tests/DCC/AdministrativeData.CoreDataType.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..5f62a27b6169f295eb96346268b7ae14c5dc20bd --- /dev/null +++ b/tests/DCC/AdministrativeData.CoreDataType.test.ts @@ -0,0 +1,119 @@ +/** + * @vitest-environment-options { "xmlPath": "./tests/resources/example.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:digitalCalibrationCertificate/dcc:administrativeData/dcc:coreData"; +const xpath = { + coreData: { + countryCodeISO3166_1: `string(${base}/dcc:countryCodeISO3166_1)`, + usedLangCodeISO639_1: `${base}/dcc:usedLangCodeISO639_1`, + mandatoryLangCodeISO639_1: `${base}/dcc:mandatoryLangCodeISO639_1`, + uniqueIdentifier: `string(${base}/dcc:uniqueIdentifier)`, + identifications: { + identification: { + issuer: `string(${base}/dcc:identifications/dcc:identification[1]/dcc:issuer)`, + value: `string(${base}/dcc:identifications/dcc:identification[1]/dcc:value)`, + name: { + content: `${base}/dcc:identifications/dcc:identification[1]/dcc:name/dcc:content`, + }, + }, + }, + receiptDate: `string(${base}/dcc:receiptDate)`, + beginPerformanceDate: `string(${base}/dcc:beginPerformanceDate)`, + endPerformanceDate: `string(${base}/dcc:endPerformanceDate)`, + performanceLocation: `string(${base}/dcc:performanceLocation)`, + }, +}; + +describe("CoreDataType", () => { + let dcc: DCCDocument, coreData: CoreDataType, dom; + + beforeEach(() => { + ({ dcc, dom } = recreateEnv()); + coreData = dcc.digitalCalibrationCertificate.administrativeData.coreData; + }); + + test("should get correct countryCodeISO3166_1 from XML", () => { + expect(coreData.countryCodeISO3166_1._text).toBe(select(xpath.coreData.countryCodeISO3166_1, dom)); + }); + + test("should get correct usedLangCodeISO639_1 from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.coreData.usedLangCodeISO639_1, dom); + expect(toTextArr(coreData.usedLangCodeISO639_1)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct mandatoryLangCodeISO639_1 from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.coreData.mandatoryLangCodeISO639_1, dom); + expect(toTextArr(coreData.mandatoryLangCodeISO639_1)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct unique identifier from XML", () => { + expect(coreData.uniqueIdentifier._text).toBe(select(xpath.coreData.uniqueIdentifier, dom)); + }); + + test("should get correct identification issuer from XML", () => { + expect(coreData.identifications.identification[0].issuer._text).toBe(select(xpath.coreData.identifications.identification.issuer, dom)); + }); + + test("should get correct identification value from XML", () => { + expect(coreData.identifications.identification[0].value._text).toBe(select(xpath.coreData.identifications.identification.value, dom)); + }); + + test("should get correct identification name content from XML", () => { + const expected = <Element[]>select(xpath.coreData.identifications.identification.name.content, dom); + expect(toTextArr(coreData.identifications.identification[0].name.content)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct receipt date from XML", () => { + expect(coreData.receiptDate._text).toBe(select(xpath.coreData.receiptDate, dom)); + }); + test("should get correct begin performance date from XML", () => { + expect(coreData.beginPerformanceDate._text).toBe(select(xpath.coreData.beginPerformanceDate, dom)); + }); + test("should get correct end performance date from XML", () => { + expect(coreData.endPerformanceDate._text).toBe(select(xpath.coreData.endPerformanceDate, dom)); + }); + test("should get correct performance location from XML", () => { + expect(coreData.performanceLocation._text).toBe(select(xpath.coreData.performanceLocation, dom)); + }); + + /* test for setters */ + test("should set usedLangCodeISO639_1 correctly", () => { + fc.assert( + fc.property(string_ISO639_1(), (str) => { + // add new element to array + coreData.usedLangCodeISO639_1.push(new DCCXMLElement({ _text: str })); + + // get actual list from xml + const actual = <Element[]>select(xpath.coreData.usedLangCodeISO639_1, dcc); + + expect(toTextArr(coreData.usedLangCodeISO639_1)).toContain(str); + expect(toTextContentArr(actual)).toContain(str); + }), + ); + }); + + test("should delete usedLangCodeISO639_1 correctly", () => { + const selection = toTextContentArr(<Element[]>select(xpath.coreData.usedLangCodeISO639_1, dom)); + fc.assert( + fc.property(fc.constantFrom(...selection), (str) => { + // get index and remove element from array + const index = indexOf(coreData.usedLangCodeISO639_1, str); + coreData.usedLangCodeISO639_1.splice(index, 1); + + // get actual list from xml + const actual = <Element[]>select(xpath.coreData.usedLangCodeISO639_1, dcc); + + expect(toTextArr(coreData.usedLangCodeISO639_1)).not.toContain(str); + expect(toTextContentArr(actual)).not.toContain(str); + }), + ); + }); +}); diff --git a/tests/DCC/AdministrativeData.Customer.test.ts b/tests/DCC/AdministrativeData.Customer.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..911936bb540030981a4a67cb91b184ddc21cb834 --- /dev/null +++ b/tests/DCC/AdministrativeData.Customer.test.ts @@ -0,0 +1,76 @@ +/** + * @vitest-environment-options { "xmlPath": "./tests/resources/example.xml" } + */ + +import { select, toTextArr, toTextContentArr } from "../util"; +import { ContactType, DCCDocument, LocationType } from "../../src"; + +const base = "/dcc:digitalCalibrationCertificate/dcc:administrativeData/dcc:customer"; +const xpath = { + customer: { + name: { + content: `${base}/dcc:name/dcc:content`, + }, + email: `string(${base}/dcc:eMail)`, + phone: `string(${base}/dcc:phone)`, + fax: `string(${base}/dcc:fax)`, + location: { + city: `${base}/dcc:location/dcc:city[1]`, + countryCode: `${base}/dcc:location/dcc:countryCode[1]`, + postCode: `${base}/dcc:location/dcc:postCode[1]`, + postBoxOffice: `${base}/dcc:location/dcc:postBoxOffice[1]`, + state: `${base}/dcc:location/dcc:state[1]`, + street: `${base}/dcc:location/dcc:street[1]`, + streetNo: `${base}/dcc:location/dcc:streetNo[1]`, + further: `${base}/dcc:location/dcc:further[1]/dcc:content`, + positionCoordinates: `${base}/dcc:location/dcc:positionCoordinates[1]`, + }, + descriptionData: `${base}/dcc:descriptionData`, + _id: `${base}/@id`, + }, +}; + +describe("ContactType", () => { + let dcc: DCCDocument, customer: ContactType, location: LocationType, dom; + + beforeEach(() => { + ({ dcc, dom } = recreateEnv()); + customer = dcc.digitalCalibrationCertificate.administrativeData.customer; + location = customer.location; /* TODO: check iff this variable is used anywhere */ + }); + + test("should get correct customer name content from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.customer.name.content, dom); + expect(toTextArr(customer.name.content)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct customer email address from XML", () => { + expect(customer.eMail._text).toBe(select(xpath.customer.email, dom)); + }); + + test("should get correct customer location city from XML", () => { + const expected = <Element[]>select(xpath.customer.location.city, dom); + expect(customer.location.city[0]._text).toEqual(toTextContentArr(expected)[0]); + }); + + test("should get correct customer location county code from XML", () => { + const expected = <Element[]>select(xpath.customer.location.countryCode, dom); + expect(customer.location.countryCode[0]._text).toEqual(toTextContentArr(expected)[0]); + }); + + test("should get correct customer location post code from XML", () => { + const expected = <Element[]>select(xpath.customer.location.postCode, dom); + expect(customer.location.postCode[0]._text).toEqual(toTextContentArr(expected)[0]); + }); + + test("should get correct customer location further from XML", () => { + const expected = <Element[]>select(xpath.customer.location.further, dom); + + for (let i = 0; i < expected.length; i++) { + expect(customer.location.further[0].content[i]._text).toBe(expected[i].textContent); + } + }); + + /* TODO: setters */ +}); diff --git a/tests/DCC/AdministrativeData.Items.test.ts b/tests/DCC/AdministrativeData.Items.test.ts index 79dfe547c9dd138e496a781666658b6e010ed1e2..ce71db48e9520ddf5a0218dd3285c657392fecc1 100644 --- a/tests/DCC/AdministrativeData.Items.test.ts +++ b/tests/DCC/AdministrativeData.Items.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/example.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/example.xml" } */ import { select, toTextArr, toTextContentArr } from "../util"; @@ -51,7 +50,7 @@ describe("ItemType", () => { let dcc: DCCDocument, item: ItemType, identification1, identification2, identification3: IdentificationType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); item = dcc.digitalCalibrationCertificate.administrativeData.items.item[0]; identification1 = item.identifications.identification[0]; identification2 = item.identifications.identification[1]; diff --git a/tests/DCC/AdministrativeData.RespPersons.test.ts b/tests/DCC/AdministrativeData.RespPersons.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..101c5d22c80ab057c5a4b8c2e984cf4e4c9ba9f9 --- /dev/null +++ b/tests/DCC/AdministrativeData.RespPersons.test.ts @@ -0,0 +1,55 @@ +/** + * @vitest-environment-options { "xmlPath": "./tests/resources/example.xml" } + */ + +import { select, toTextArr, toTextContentArr } from "../util"; +import { RespPersonType, DCCDocument } from "../../src"; + +const base = "/dcc:digitalCalibrationCertificate/dcc:administrativeData/dcc:respPersons"; +const xpath = { + respPersons: { + respPerson1: { + person: { + name: { + content: `${base}/dcc:respPerson[1]/dcc:person/dcc:name/dcc:content`, + }, + }, + mainSigner: `string(${base}/dcc:respPerson[1]/dcc:mainSigner)`, + }, + respPerson2: { + person: { + name: { + content: `${base}/dcc:respPerson[2]/dcc:person/dcc:name/dcc:content`, + }, + }, + }, + }, +}; + +describe("ContactType", () => { + let dcc: DCCDocument, respPerson1, respPerson2: RespPersonType, dom; + + beforeEach(() => { + ({ dcc, dom } = recreateEnv()); + respPerson1 = dcc.digitalCalibrationCertificate.administrativeData.respPersons.respPerson[0]; + respPerson2 = dcc.digitalCalibrationCertificate.administrativeData.respPersons.respPerson[1]; + }); + + test("should get correct responsible person 1 name content from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.respPersons.respPerson1.person.name.content, dom); + expect(toTextArr(respPerson1.person.name.content)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct responsible person 1 main signer flag from XML", () => { + expect(respPerson1.mainSigner._text).toBe(select(xpath.respPersons.respPerson1.mainSigner, dom)); + }); + + test("should get correct responsible person 2 name content from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.respPersons.respPerson2.person.name.content, dom); + expect(toTextArr(respPerson2.person.name.content)).toEqual(toTextContentArr(expected)); + }); + + /* TODO: setters */ +}); diff --git a/tests/DCC/AdministrativeData.SoftwareListType.test.ts b/tests/DCC/AdministrativeData.SoftwareListType.test.ts index 6139807094ad603ad938155b8fbf37502d4cef68..348629014c6410af3b3cef86ddb1ccf585fd8f74 100644 --- a/tests/DCC/AdministrativeData.SoftwareListType.test.ts +++ b/tests/DCC/AdministrativeData.SoftwareListType.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/example.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/example.xml" } */ import { select, toTextArr, toTextContentArr } from "../util"; @@ -24,7 +23,7 @@ describe("DccSoftwareType", () => { let dcc: DCCDocument, dccSoftware: SoftwareListType, software: SoftwareType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); dccSoftware = dcc.digitalCalibrationCertificate.administrativeData.dccSoftware; software = dccSoftware.software[0]; }); diff --git a/tests/DCC/AdministrativeData.Statements.test.ts b/tests/DCC/AdministrativeData.Statements.test.ts new file mode 100644 index 0000000000000000000000000000000000000000..f3de295a241518fa96470e400b0eb0f2d28cb83e --- /dev/null +++ b/tests/DCC/AdministrativeData.Statements.test.ts @@ -0,0 +1,212 @@ +/** + * @vitest-environment-options { "xmlPath": "./tests/resources/example.xml" } + */ + +import { select, toTextArr, toTextContentArr } from "../util"; +import { StatementMetaDataType, DCCDocument } from "../../src"; + +const base = "/dcc:digitalCalibrationCertificate/dcc:administrativeData/dcc:statements"; +const xpath = { + statements: { + statement1: { + norm: `string(${base}/dcc:statement[1]/dcc:norm)`, + reference: `string(${base}/dcc:statement[1]/dcc:reference)`, + declaration: { + content: `${base}/dcc:statement[1]/dcc:declaration/dcc:content`, + }, + refType: `string(${base}/dcc:statement[1]/@refType)`, + }, + statement2: { + declaration: { + content: `${base}/dcc:statement[2]/dcc:declaration/dcc:content`, + }, + data: { + quantity1: { + name: { + content: `${base}/dcc:statement[2]/dcc:data/dcc:quantity[1]/dcc:name/dcc:content`, + }, + si_real: { + si_value: `string(${base}/dcc:statement[2]/dcc:data/dcc:quantity[1]/si:real/si:value)`, + si_unit: `string(${base}/dcc:statement[2]/dcc:data/dcc:quantity[1]/si:real/si:unit)`, + }, + }, + quantity2: { + name: { + content: `${base}/dcc:statement[2]/dcc:data/dcc:quantity[2]/dcc:name/dcc:content`, + }, + si_real: { + si_value: `string(${base}/dcc:statement[2]/dcc:data/dcc:quantity[2]/si:real/si:value)`, + si_unit: `string(${base}/dcc:statement[2]/dcc:data/dcc:quantity[2]/si:real/si:unit)`, + }, + }, + }, + refType: `string(${base}/dcc:statement[2]/@refType)`, + }, + statement3: { + declaration: { + content: `${base}/dcc:statement[3]/dcc:declaration/dcc:content`, + }, + respAuthority: { + name: { + content: `${base}/dcc:statement[3]/dcc:respAuthority/dcc:name/dcc:content`, + }, + email: `string(${base}/dcc:statement[3]/dcc:respAuthority/dcc:email)`, + location: { + city: `string(${base}/dcc:statement[3]/dcc:respAuthority/dcc:location/dcc:city)`, + countryCode: `string(${base}/dcc:statement[3]/dcc:respAuthority/dcc:location/dcc:countryCode)`, + postCode: `string(${base}/dcc:statement[3]/dcc:respAuthority/dcc:location/dcc:postCode)`, + }, + }, + conformity: `string(${base}/dcc:statement[3]/dcc:conformity)`, + refType: `string(${base}/dcc:statement[3]/@refType)`, + }, + statement4: { + declaration: { + content: `${base}/dcc:statement[4]/dcc:declaration/dcc:content`, + }, + date: `string(${base}/dcc:statement[4]/dcc:date)`, + respAuthority: { + name: { + content: `${base}/dcc:statement[3]/dcc:respAuthority/dcc:name/dcc:content`, + }, + email: `string(${base}/dcc:statement[3]/dcc:respAuthority/dcc:email)`, + location: { + city: `string(${base}/dcc:statement[3]/dcc:respAuthority/dcc:location/dcc:city)`, + countryCode: `string(${base}/dcc:statement[3]/dcc:respAuthority/dcc:location/dcc:countryCode)`, + postCode: `string(${base}/dcc:statement[3]/dcc:respAuthority/dcc:location/dcc:postCode)`, + }, + }, + refType: `string(${base}/dcc:statement[4]/@refType)`, + }, + }, +}; + +describe("ItemType", () => { + let dcc: DCCDocument, statement1, statement2, statement3, statement4: StatementMetaDataType, dom; + + beforeEach(() => { + ({ dcc, dom } = recreateEnv()); + statement1 = dcc.digitalCalibrationCertificate.administrativeData.statements.statement[0]; + statement2 = dcc.digitalCalibrationCertificate.administrativeData.statements.statement[1]; + statement3 = dcc.digitalCalibrationCertificate.administrativeData.statements.statement[2]; + statement4 = dcc.digitalCalibrationCertificate.administrativeData.statements.statement[3]; + }); + + test("should get correct statement 1 declaration content from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.statements.statement1.declaration.content, dom); + expect(toTextArr(statement1.declaration.content)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct statement 1 norm model from XML", () => { + expect(statement1.norm[0]._text).toBe(select(xpath.statements.statement1.norm, dom)); + }); + + test("should get correct statement 1 reference from XML", () => { + expect(statement1.reference[0]._text).toBe(select(xpath.statements.statement1.reference, dom)); + }); + + test("should get correct statement 2 declaration content from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.statements.statement2.declaration.content, dom); + expect(toTextArr(statement2.declaration.content)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct statement 2 data quantity 1 name content from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.statements.statement2.data.quantity1.name.content, dom); + expect(toTextArr(statement2.data.quantity[0].name.content)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct statement 2 data quantity 1 si:value from XML", () => { + expect(statement2.data.quantity[0].real.value._text).toBe(select(xpath.statements.statement2.data.quantity1.si_real.si_value, dom)); + }); + + test("should get correct statement 2 data quantity 2 si:unit from XML", () => { + expect(statement2.data.quantity[0].real.unit._text).toBe(select(xpath.statements.statement2.data.quantity1.si_real.si_unit, dom)); + }); + + test("should get correct statement 2 data quantity 2 name content from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.statements.statement2.data.quantity2.name.content, dom); + expect(toTextArr(statement2.data.quantity[1].name.content)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct statement 2 data quantity 2 si:value from XML", () => { + expect(statement2.data.quantity[1].real.value._text).toBe(select(xpath.statements.statement2.data.quantity2.si_real.si_value, dom)); + }); + + test("should get correct statement 2 data quantity 2 si:unit from XML", () => { + expect(statement2.data.quantity[1].real.unit._text).toBe(select(xpath.statements.statement2.data.quantity2.si_real.si_unit, dom)); + }); + + test("should get correct statement 2 refType from XML", () => { + expect(statement2._attr.refType).toBe(select(xpath.statements.statement2.refType, dom)); + }); + + test("should get correct statement 3 declaration content from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.statements.statement3.declaration.content, dom); + expect(toTextArr(statement3.declaration.content)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct statement 3 responsible authority name content from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.statements.statement3.respAuthority.name.content, dom); + expect(toTextArr(statement3.respAuthority.name.content)).toEqual(toTextContentArr(expected)); + }); + + /* responsible authority 3 */ + test("should get correct statement 3 responsible authority email from XML", () => { + expect(statement3.respAuthority.eMail._text).toBe(select(xpath.statements.statement3.respAuthority.email, dom)); + }); + + test("should get correct statement 3 responsible authority location city from XML", () => { + expect(statement3.respAuthority.location.city[0]._text).toBe(select(xpath.statements.statement3.respAuthority.location.city, dom)); + }); + test("should get correct statement 3 responsible authority location country code from XML", () => { + expect(statement3.respAuthority.location.countryCode[0]._text).toBe(select(xpath.statements.statement3.respAuthority.location.countryCode, dom)); + }); + test("should get correct statement 3 responsible authority location post code from XML", () => { + expect(statement3.respAuthority.location.postCode[0]._text).toBe(select(xpath.statements.statement3.respAuthority.location.postCode, dom)); + }); + + test("should get correct statement 3 conformity from XML", () => { + expect(statement3.conformity._text).toBe(select(xpath.statements.statement3.conformity, dom)); + }); + + test("should get correct statement 3 refType from XML", () => { + expect(statement3._attr.refType).toBe(select(xpath.statements.statement3.refType, dom)); + }); + + test("should get correct statement 4 declaration content from XML", () => { + // get expected list from example xml + const expected = <Element[]>select(xpath.statements.statement4.declaration.content, dom); + expect(toTextArr(statement4.declaration.content)).toEqual(toTextContentArr(expected)); + }); + + test("should get correct statement 4 date from XML", () => { + expect(statement4.date._text).toBe(select(xpath.statements.statement4.date, dom)); + }); + + /* responsible authority 4 */ + test("should get correct statement 4 responsible authority email from XML", () => { + expect(statement4.respAuthority.eMail._text).toBe(select(xpath.statements.statement4.respAuthority.email, dom)); + }); + + test("should get correct statement 4 responsible authority location city from XML", () => { + expect(statement4.respAuthority.location.city[0]._text).toBe(select(xpath.statements.statement4.respAuthority.location.city, dom)); + }); + test("should get correct statement 4 responsible authority location country code from XML", () => { + expect(statement4.respAuthority.location.countryCode[0]._text).toBe(select(xpath.statements.statement4.respAuthority.location.countryCode, dom)); + }); + test("should get correct statement 4 responsible authority location post code from XML", () => { + expect(statement4.respAuthority.location.postCode[0]._text).toBe(select(xpath.statements.statement4.respAuthority.location.postCode, dom)); + }); + + test("should get correct statement 4 refType from XML", () => { + expect(statement4._attr.refType).toBe(select(xpath.statements.statement4.refType, dom)); + }); + + /* TODO: setters */ +}); diff --git a/tests/DCC/AdministrativeData.test.ts b/tests/DCC/AdministrativeData.test.ts index b6f6aded6f213f7e171ac2cf52a9def678df1257..920cf986f6e10572c7a9540da958539e948de164 100644 --- a/tests/DCC/AdministrativeData.test.ts +++ b/tests/DCC/AdministrativeData.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/example.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/example.xml" } */ import { testCalibrationLaboratory } from "./common/AdministrativeData/CalibrationLaboratory"; diff --git a/tests/DCC/DigitalCalibrationCertificateType.test.ts b/tests/DCC/DigitalCalibrationCertificateType.test.ts index eaceec37e2432ea659fed9d601e3fd818e3cb15a..917b0b98b53bacd0c5695f0f13500cb07fc6db23 100644 --- a/tests/DCC/DigitalCalibrationCertificateType.test.ts +++ b/tests/DCC/DigitalCalibrationCertificateType.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/example.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/example.xml" } */ import { select } from "../util"; @@ -11,7 +10,7 @@ describe("DigitalCalibrationCertificateType", () => { let xml, dcc, dom; beforeEach(() => { - ({ xml, dcc, dom } = xmlEnv.recreateEnv()); + ({ xml, dcc, dom } = recreateEnv()); }); test("should get correct schemaVersion from XML", () => { diff --git a/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.CalibrationLaboratory.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.CalibrationLaboratory.test.ts index 0bf3cced84adb6649cfe6610c7c14b87d1f11c72..e56ab79f9ecbb2738a8cc36a265409e7d0b19f8e 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.CalibrationLaboratory.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.CalibrationLaboratory.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -26,7 +25,7 @@ describe("GP_DCC_Temperature_Simplified: CalibrationLaboratoryType", () => { let dcc: DCCDocument, calibrationLaboratory: CalibrationLaboratoryType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); calibrationLaboratory = dcc.digitalCalibrationCertificate.administrativeData.calibrationLaboratory; }); diff --git a/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.CoreDataType.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.CoreDataType.test.ts index 0c3aaf0e342ccba99f5008b24a05d90f3b203562..de866931480ecfe0dfca84ba9ccb1041afb4f8c8 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.CoreDataType.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.CoreDataType.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified.xml" } */ import * as fc from "fast-check"; @@ -34,7 +33,7 @@ describe("GP_DCC_Temperature_Simplified: CoreDataType", () => { let dcc: DCCDocument, coreData: CoreDataType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); coreData = dcc.digitalCalibrationCertificate.administrativeData.coreData; }); diff --git a/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.Customer.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.Customer.test.ts index 99bc252bd9f99c08f901d64d63228d5d26390dcf..4ecf28e0ddaea32aa8e86a6b3dcc4cf465c1ed57 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.Customer.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.Customer.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -28,7 +27,7 @@ describe("GP_DCC_Temperature_Simplified: ContactType", () => { let dcc: DCCDocument, customer: ContactType, location: LocationType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); customer = dcc.digitalCalibrationCertificate.administrativeData.customer; location = customer.location; /* TODO: check iff this variable is used anywhere */ }); diff --git a/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.Items.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.Items.test.ts index 66f37cfb0794bc77eb7fb21789c32294426879a7..5b62ce3ffabe91072decd35b3179397aee10b286 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.Items.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.Items.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -51,7 +50,7 @@ describe("GP_DCC_Temperature_Simplified: ItemType", () => { let dcc: DCCDocument, item: ItemType, identification1, identification2, identification3: IdentificationType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); item = dcc.digitalCalibrationCertificate.administrativeData.items.item[0]; identification1 = item.identifications.identification[0]; identification2 = item.identifications.identification[1]; diff --git a/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.RespPersons.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.RespPersons.test.ts index 8d52086066b11d641bbc1108e37aa7b8b58107b1..b066bcbce1e38a3a6b4f037566c10d285c631d57 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.RespPersons.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.RespPersons.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -31,7 +30,7 @@ describe("GP_DCC_Temperature_Simplified: RespPersonType", () => { let dcc: DCCDocument, respPerson1, respPerson2: RespPersonType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); respPerson1 = dcc.digitalCalibrationCertificate.administrativeData.respPersons.respPerson[0]; respPerson2 = dcc.digitalCalibrationCertificate.administrativeData.respPersons.respPerson[1]; }); diff --git a/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.SoftwareListType.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.SoftwareListType.test.ts index fb27ba6f77573b755794f2bb03ffbf92ec759cd2..e6d4a11c161da6052e97566d312039b70e84e78b 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.SoftwareListType.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.SoftwareListType.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -20,7 +19,7 @@ describe("GP_DCC_Temperature_Simplified: DccSoftwareType", () => { let dcc: DCCDocument, dccSoftware: SoftwareListType, software: SoftwareType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); dccSoftware = dcc.digitalCalibrationCertificate.administrativeData.dccSoftware; software = dccSoftware.software[0]; }); diff --git a/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.Statements.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.Statements.test.ts index f68a629de17b2ad994e5ba10de64dd75e4d02f18..2b135b1cfd113a47829cb9951256bb82c0737355 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.Statements.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified/AdministrativeData.Statements.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -52,7 +51,7 @@ describe("GP_DCC_Temperature_Simplified: StatementMetaDataType", () => { let dcc: DCCDocument, statement1, statement2: StatementMetaDataType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); statement1 = dcc.digitalCalibrationCertificate.administrativeData.statements.statement[0]; statement2 = dcc.digitalCalibrationCertificate.administrativeData.statements.statement[1]; }); diff --git a/tests/DCC/GP_DCC_Temperature_Simplified/DigitalCalibrationCertificateType.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified/DigitalCalibrationCertificateType.test.ts index df17932841adeec6409042ea38cd0f3a381580aa..b8a703970b0f3939e40796c0f7341ca070272db5 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified/DigitalCalibrationCertificateType.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified/DigitalCalibrationCertificateType.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified.xml" } */ import { select } from "../../util"; @@ -11,7 +10,7 @@ describe("GP_DCC_Temperature_Simplified: DigitalCalibrationCertificateType", () let xml, dcc, dom; beforeEach(() => { - ({ xml, dcc, dom } = xmlEnv.recreateEnv()); + ({ xml, dcc, dom } = recreateEnv()); }); test("should get correct schemaVersion from XML", () => { diff --git a/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts index f989c1d20662108888caf7d4142a4b4ddcd39a31..863afe1859d552d81e072b4c0cb48dac0b54db3a 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -84,7 +83,7 @@ describe("GP_DCC_Temperature_Simplified: InfluenceConditionListType", () => { let dcc: DCCDocument, influenceConditions: InfluenceConditionListType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); influenceConditions = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].influenceConditions; }); diff --git a/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts index d130350529ce3a5100676c939221b0735859e659..ef4b706dfa418df4a434f44d2fe1d362dcdea4b4 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -28,7 +27,7 @@ describe("GP_DCC_Temperature_Simplified: MeasuringEquipmentType", () => { let dcc: DCCDocument, measuringEquipment: MeasuringEquipmentType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); measuringEquipment = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].measuringEquipments.measuringEquipment[0]; }); diff --git a/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.Name.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.Name.test.ts index 6fad3dfb600c799b1db5e64e14b41b8adb15a948..237dc63f2dcc8a21fa3ae6a1da4f03f4fe3b457c 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.Name.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.Name.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -21,7 +20,7 @@ describe("GP_DCC_Temperature_Simplified: MeasurementResultType", () => { let dcc: DCCDocument, measurementResult: MeasurementResultType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); measurementResult = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0]; }); diff --git a/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.Results.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.Results.test.ts index 4fd76812bb8ddd98fbf6ccf6f87d55947b72812a..eba3b9c76ab8c253b1691c97293762b78b414017 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.Results.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.Results.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -106,7 +105,7 @@ describe("GP_DCC_Temperature_Simplified: ResultType", () => { let dcc: DCCDocument, result: ResultType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); result = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].results.result[0]; }); diff --git a/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.UsedMethods.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.UsedMethods.test.ts index 6becd0f772fca196b423bf989e7f3fb04b2aae75..3702d113d13e3887d86ec3b2ed480aebd28e5f03 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.UsedMethods.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified/MeasurementResults.MeasurementResult.UsedMethods.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -26,7 +25,7 @@ describe("GP_DCC_Temperature_Simplified: UsedMethodListType", () => { let dcc: DCCDocument, usedMethods: UsedMethodListType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); usedMethods = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].usedMethods; }); diff --git a/tests/DCC/GP_DCC_Temperature_Simplified_variant/AdministrativeData.Items_variant.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified_variant/AdministrativeData.Items_variant.test.ts index de4e31006f2e0a79a16e2d3571aa462fe65d2e28..68a193b90dfc8e93464a04fe95e0a822db009663 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified_variant/AdministrativeData.Items_variant.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified_variant/AdministrativeData.Items_variant.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified_variant.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified_variant.xml" } */ import { select } from "../../util"; @@ -22,7 +21,7 @@ describe("GP_DCC_Temperature_Typical: ItemType", () => { let dcc: DCCDocument, item: ItemType, equipmentClass: EquipmentClassType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); item = dcc.digitalCalibrationCertificate.administrativeData.items.item[0]; equipmentClass = item.equipmentClass[0]; }); diff --git a/tests/DCC/GP_DCC_Temperature_Simplified_variant/AdministrativeData.Statements_variant.test.ts b/tests/DCC/GP_DCC_Temperature_Simplified_variant/AdministrativeData.Statements_variant.test.ts index 26ad9a3656a417a6d9a2f666be1b254f136ca85b..2ed48e7888b4811d006687c033f15047cb45bf52 100644 --- a/tests/DCC/GP_DCC_Temperature_Simplified_variant/AdministrativeData.Statements_variant.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Simplified_variant/AdministrativeData.Statements_variant.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Simplified_variant.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Simplified_variant.xml" } */ import * as fc from "fast-check"; @@ -26,7 +25,7 @@ describe("GP_DCC_Temperature_Simplified: StatementMetaDataType", () => { let dcc: DCCDocument, statement3: StatementMetaDataType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); statement3 = dcc.digitalCalibrationCertificate.administrativeData.statements.statement[2]; }); diff --git a/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.CalibrationLaboratory.test.ts b/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.CalibrationLaboratory.test.ts index fdaf96a8e5330b63bdd61a090a4d7596711ef0c5..4809389a86add4fef48e0aac5f4f64ba9edd5e92 100644 --- a/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.CalibrationLaboratory.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.CalibrationLaboratory.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Typical.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Typical.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -26,7 +25,7 @@ describe("GP_DCC_Temperature_Typical: CalibrationLaboratoryType", () => { let dcc: DCCDocument, calibrationLaboratory: CalibrationLaboratoryType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); calibrationLaboratory = dcc.digitalCalibrationCertificate.administrativeData.calibrationLaboratory; }); diff --git a/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.CoreDataType.test.ts b/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.CoreDataType.test.ts index da8c8eef5bfb4a343e752de85d788c50f86da66c..62dfb120cf4e2f962342bcdc49c88bd4c3b28607 100644 --- a/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.CoreDataType.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.CoreDataType.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Typical.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Typical.xml" } */ import * as fc from "fast-check"; @@ -35,7 +34,7 @@ describe("GP_DCC_Temperature_Typical: CoreDataType", () => { let dcc: DCCDocument, coreData: CoreDataType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); coreData = dcc.digitalCalibrationCertificate.administrativeData.coreData; }); diff --git a/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.Customer.test.ts b/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.Customer.test.ts index e03dd5c937697249483c739b4f8ab0ab4390b744..2c9ad6b778f119a41c84167c2b643427e839c644 100644 --- a/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.Customer.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.Customer.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Typical.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Typical.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -35,7 +34,7 @@ describe("GP_DCC_Temperature_Typical: ContactType", () => { let dcc: DCCDocument, customer: ContactType, location: LocationType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); customer = dcc.digitalCalibrationCertificate.administrativeData.customer; location = customer.location; /* TODO: check iff this variable is used anywhere */ }); diff --git a/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.Items.test.ts b/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.Items.test.ts index dce1bac30f28aff286bee030f6e18e635c311e35..b6f216f39cb32265f15159ff38d70e7c3d277cf3 100644 --- a/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.Items.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.Items.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Typical.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Typical.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -51,7 +50,7 @@ describe("GP_DCC_Temperature_Typical: ItemType", () => { let dcc: DCCDocument, item: ItemType, identification1, identification2, identification3: IdentificationType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); item = dcc.digitalCalibrationCertificate.administrativeData.items.item[0]; identification1 = item.identifications.identification[0]; identification2 = item.identifications.identification[1]; diff --git a/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.RespPersons.test.ts b/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.RespPersons.test.ts index 583b3f8071a2067f9806c3dc4c75991c17cb19a4..58c2b1069f4f937b9a6f49ea2cd7dbde2f53ef0a 100644 --- a/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.RespPersons.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.RespPersons.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Typical.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Typical.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -31,7 +30,7 @@ describe("GP_DCC_Temperature_Typical: RespPersonType", () => { let dcc: DCCDocument, respPerson1, respPerson2: RespPersonType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); respPerson1 = dcc.digitalCalibrationCertificate.administrativeData.respPersons.respPerson[0]; respPerson2 = dcc.digitalCalibrationCertificate.administrativeData.respPersons.respPerson[1]; }); diff --git a/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.SoftwareListType.test.ts b/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.SoftwareListType.test.ts index cb02695dd288895cee0fbd635b1a7552fd9de7e2..e08ed6270dd15edda3d13bcc38d78d000ca18702 100644 --- a/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.SoftwareListType.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.SoftwareListType.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Typical.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Typical.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -22,7 +21,7 @@ describe("GP_DCC_Temperature_Typical: DccSoftwareType", () => { let dcc: DCCDocument, dccSoftware: SoftwareListType, software: SoftwareType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); dccSoftware = dcc.digitalCalibrationCertificate.administrativeData.dccSoftware; software = dccSoftware.software[0]; }); diff --git a/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.Statements.test.ts b/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.Statements.test.ts index 0c5ae363f8a457ac8c3e210f06de25d667391e85..147a7986e7f5eaf3324e83800fe1adfbb63cb67e 100644 --- a/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.Statements.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Typical/AdministrativeData.Statements.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Typical.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Typical.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -86,7 +85,7 @@ describe("GP_DCC_Temperature_Typical: StatementMetaDataType", () => { let dcc: DCCDocument, statement1, statement2, statement3, statement4: StatementMetaDataType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); statement1 = dcc.digitalCalibrationCertificate.administrativeData.statements.statement[0]; statement2 = dcc.digitalCalibrationCertificate.administrativeData.statements.statement[1]; statement3 = dcc.digitalCalibrationCertificate.administrativeData.statements.statement[2]; diff --git a/tests/DCC/GP_DCC_Temperature_Typical/DigitalCalibrationCertificateType.test.ts b/tests/DCC/GP_DCC_Temperature_Typical/DigitalCalibrationCertificateType.test.ts index 110f0961f44989f54d8e5fb07957bcf1abafb262..f7b0a34012a8c2a77c54dd4ad075e8401529b077 100644 --- a/tests/DCC/GP_DCC_Temperature_Typical/DigitalCalibrationCertificateType.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Typical/DigitalCalibrationCertificateType.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Typical.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Typical.xml" } */ import { select } from "../../util"; @@ -11,7 +10,7 @@ describe("GP_DCC_Temperature_Typical: DigitalCalibrationCertificateType", () => let xml, dcc, dom; beforeEach(() => { - ({ xml, dcc, dom } = xmlEnv.recreateEnv()); + ({ xml, dcc, dom } = recreateEnv()); }); test("should get correct schemaVersion from XML", () => { diff --git a/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts b/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts index 436f8d3cfdb896d88cf1d725aca46f9d1c9830ac..9ab5918a30111a0c0b924448aacf44738566fb03 100644 --- a/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Typical.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Typical.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -103,7 +102,7 @@ describe("GP_DCC_Temperature_Typical: InfluenceConditionListType", () => { let dcc: DCCDocument, influenceConditions: InfluenceConditionListType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); influenceConditions = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].influenceConditions; }); diff --git a/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts b/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts index 856134e3b20e1097515536d9e15bd1b5bbc5ea23..0ec9d181130564c4b5b56eb299f13feeae6a04d8 100644 --- a/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Typical.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Typical.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -28,7 +27,7 @@ describe("GP_DCC_Temperature_Typical: MeasuringEquipmentType", () => { let dcc: DCCDocument, measuringEquipment: MeasuringEquipmentType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); measuringEquipment = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].measuringEquipments.measuringEquipment[0]; }); diff --git a/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.Name.test.ts b/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.Name.test.ts index 892a1f3a67ceb943ac5b7c326d960982e48efa37..076be1a2e0ed4c47759f675c30517134d4c88697 100644 --- a/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.Name.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.Name.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Typical.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Typical.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -21,7 +20,7 @@ describe("GP_DCC_Temperature_Typical: MeasurementResultType", () => { let dcc: DCCDocument, measurementResult: MeasurementResultType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); measurementResult = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0]; }); diff --git a/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.Results.test.ts b/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.Results.test.ts index 9efe9ae6ca8da0e0dade5628f0a2cc6619c206bd..6920a114ffa6ce617edb892d8aeca9ecc658203d 100644 --- a/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.Results.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.Results.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Typical.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Typical.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -101,7 +100,7 @@ describe("GP_DCC_Temperature_Typical: ResultType", () => { let dcc: DCCDocument, result: ResultType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); result = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].results.result[0]; }); diff --git a/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.UsedMethods.test.ts b/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.UsedMethods.test.ts index 4738344ed87df3ccfc460c1b397ced4835c73c41..1fc11df272efbdcae468535e0003e3a9ad8b0af9 100644 --- a/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.UsedMethods.test.ts +++ b/tests/DCC/GP_DCC_Temperature_Typical/MeasurementResults.MeasurementResult.UsedMethods.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_Typical.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_Typical.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -39,7 +38,7 @@ describe("GP_DCC_Temperature_Typical: UsedMethodListType", () => { let dcc: DCCDocument, usedMethods: UsedMethodListType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); usedMethods = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].usedMethods; }); diff --git a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.CalibrationLaboratory.test.ts b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.CalibrationLaboratory.test.ts index 2e618ce994adcfa38227bf585706a42ab6f43623..a62165fc13b4267702773d635a2442759f9f3d15 100644 --- a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.CalibrationLaboratory.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.CalibrationLaboratory.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -26,7 +25,7 @@ describe("GP_Temperature_v3.2.0_DCC: CalibrationLaboratoryType", () => { let dcc: DCCDocument, calibrationLaboratory: CalibrationLaboratoryType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); calibrationLaboratory = dcc.digitalCalibrationCertificate.administrativeData.calibrationLaboratory; }); diff --git a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.CoreDataType.test.ts b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.CoreDataType.test.ts index 4affcd1bd8c9f4b7dafdc6a61b771c57a71b3029..773f0733fb231761f8d08e5fd7139b44cb9e19eb 100644 --- a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.CoreDataType.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.CoreDataType.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import * as fc from "fast-check"; @@ -36,7 +35,7 @@ describe("GP_Temperature_v3.2.0_DCC: CoreDataType", () => { let dcc: DCCDocument, coreData: CoreDataType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); coreData = dcc.digitalCalibrationCertificate.administrativeData.coreData; }); diff --git a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.Customer.test.ts b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.Customer.test.ts index af5a4566b85a5fb345549d615a60cf9eb31e3584..4404f78cc1d9d8b4ab566dba9de40cf954a25d64 100644 --- a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.Customer.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.Customer.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -28,7 +27,7 @@ describe("GP_Temperature_v3.2.0_DCC: ContactType", () => { let dcc: DCCDocument, customer: ContactType, location: LocationType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); customer = dcc.digitalCalibrationCertificate.administrativeData.customer; location = customer.location; /* TODO: check iff this variable is used anywhere */ }); diff --git a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.Items.test.ts b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.Items.test.ts index f1d47d2e60fad0f7e59c08072580edc95f824942..e5e1e488e07048b6d9e5521115f9c53706ae8101 100644 --- a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.Items.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.Items.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -62,7 +61,7 @@ describe("GP_Temperature_v3.2.0_DCC: ItemType", () => { let dcc: DCCDocument, item: ItemType, identification1, identification2, identification3: IdentificationType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); item = dcc.digitalCalibrationCertificate.administrativeData.items.item[0]; identification1 = item.identifications.identification[0]; identification2 = item.identifications.identification[1]; diff --git a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.RefTypeDefinitons.test.ts b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.RefTypeDefinitons.test.ts index 55167b5a7a20b58832bc0792eb30dea150cccd59..25f3e6580843fb6b5929d5eda024ca94b62fbd40 100644 --- a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.RefTypeDefinitons.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.RefTypeDefinitons.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -28,7 +27,7 @@ describe("GP_Temperature_v3.2.0_DCC: RefTypeDefinitionType", () => { let dcc: DCCDocument, refTypeDefinition: RefTypeDefinitionType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); refTypeDefinition = dcc.digitalCalibrationCertificate.administrativeData.refTypeDefinitions.refTypeDefinition[0]; }); diff --git a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.RespPersons.test.ts b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.RespPersons.test.ts index a2ac963ea85d4fa0070eb7e1fb055eb41f887b8d..73c8b82cc2648692d4c20b600ba13a083fe925ba 100644 --- a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.RespPersons.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.RespPersons.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -31,7 +30,7 @@ describe("GP_Temperature_v3.2.0_DCC: RespPersonType", () => { let dcc: DCCDocument, respPerson1, respPerson2: RespPersonType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); respPerson1 = dcc.digitalCalibrationCertificate.administrativeData.respPersons.respPerson[0]; respPerson2 = dcc.digitalCalibrationCertificate.administrativeData.respPersons.respPerson[1]; }); diff --git a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.SoftwareListType.test.ts b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.SoftwareListType.test.ts index fd5381e792cd0c29372e13db2a3d3ea38ac50a23..95c0088745d49da9f36a1304684e7af5a83e1931 100644 --- a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.SoftwareListType.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.SoftwareListType.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -27,7 +26,7 @@ describe("GP_Temperature_v3.2.0_DCC: DccSoftwareType", () => { let dcc: DCCDocument, dccSoftware: SoftwareListType, software: SoftwareType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); dccSoftware = dcc.digitalCalibrationCertificate.administrativeData.dccSoftware; software = dccSoftware.software[0]; }); diff --git a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.Statements.test.ts b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.Statements.test.ts index 9cf4423b3d88f7c4a028e78a9cda6735605d9690..b943a0aa15b776d7543bcf0e169b0fcb90d70c15 100644 --- a/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.Statements.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.0_DCC/AdministrativeData.Statements.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -52,7 +51,7 @@ describe("GP_Temperature_v3.2.0_DCC: StatementMetaDataType", () => { let dcc: DCCDocument, statement1, statement2: StatementMetaDataType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); statement1 = dcc.digitalCalibrationCertificate.administrativeData.statements.statement[0]; statement2 = dcc.digitalCalibrationCertificate.administrativeData.statements.statement[1]; }); diff --git a/tests/DCC/GP_Temperatur_v3.2.0_DCC/DigitalCalibrationCertificateType.test.ts b/tests/DCC/GP_Temperatur_v3.2.0_DCC/DigitalCalibrationCertificateType.test.ts index c279ef1432b2125a56ecd2447b863b249005ecb9..467d936d90ee093ccd95ef9ca466ebeb1dce87a9 100644 --- a/tests/DCC/GP_Temperatur_v3.2.0_DCC/DigitalCalibrationCertificateType.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.0_DCC/DigitalCalibrationCertificateType.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select } from "../../util"; @@ -11,7 +10,7 @@ describe("GP_Temperature_v3.2.0_DCC: DigitalCalibrationCertificateType", () => { let xml, dcc, dom; beforeEach(() => { - ({ xml, dcc, dom } = xmlEnv.recreateEnv()); + ({ xml, dcc, dom } = recreateEnv()); }); test("should get correct schemaVersion from XML", () => { diff --git a/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts b/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts index d40fa2796ad945dbe4396b97a977e9f192c11616..ce1bb2630a83b3711f4e41e23df5419f6b067a90 100644 --- a/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -84,7 +83,7 @@ describe("GP_Temperature_v3.2.0_DCC: InfluenceConditionListType", () => { let dcc: DCCDocument, influenceConditions: InfluenceConditionListType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); influenceConditions = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].influenceConditions; }); diff --git a/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts b/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts index 9a03c23ec44d12ab9600d11ae27235c6f918cc1b..ffdb5cd80a5e7a6e4be5d74d9f58c15abcf531fc 100644 --- a/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -28,7 +27,7 @@ describe("GP_Temperature_v3.2.0_DCC: MeasuringEquipmentType", () => { let dcc: DCCDocument, measuringEquipment: MeasuringEquipmentType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); measuringEquipment = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].measuringEquipments.measuringEquipment[0]; }); diff --git a/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.Name.test.ts b/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.Name.test.ts index 903a5240b8880f59c50838429b6e331ae6d122f8..05660a4850c2032fef74486421faac0351fafed4 100644 --- a/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.Name.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.Name.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -21,7 +20,7 @@ describe("GP_Temperature_v3.2.0_DCC: MeasurementResultType", () => { let dcc: DCCDocument, measurementResult: MeasurementResultType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); measurementResult = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0]; }); diff --git a/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.Results.test.ts b/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.Results.test.ts index 0198891103d1c8d0b65b5b4d6ef6662be848586f..63aa15905240e5a5ddb21a4821f485c90fb589bb 100644 --- a/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.Results.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.Results.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -206,7 +205,7 @@ describe("GP_Temperature_v3.2.0_DCC: ResultType", () => { let dcc: DCCDocument, result: ResultType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); result = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].results.result[0]; }); diff --git a/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.UsedMethods.test.ts b/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.UsedMethods.test.ts index 1651c10d93ee55b0c552069d5dad060cbc0822e8..8352a94bbd9221adf431375a94abaf5d990ba7f5 100644 --- a/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.UsedMethods.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.0_DCC/MeasurementResults.MeasurementResult.UsedMethods.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -26,7 +25,7 @@ describe("GP_Temperature_v3.2.0_DCC: UsedMethodListType", () => { let dcc: DCCDocument, usedMethods: UsedMethodListType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); usedMethods = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].usedMethods; }); 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 7d9e8e73beb82673906041aa52e2f6d09e579fb2..8df1fe85e03f0e97f09a0163c0f46a7d88e21166 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 @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.1_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.1_DCC.xml" } */ import { select } from "../../util"; @@ -20,7 +19,7 @@ describe("GP_Temperature_v3.2.1_DCC: CoreDataType", () => { let dcc: DCCDocument, coreData: CoreDataType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); coreData = dcc.digitalCalibrationCertificate.administrativeData.coreData; }); 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 index 08474c9c177e2324b0dca0593976d4098dfa24f6..12eb493dc56a2cf77ae5b8861ee5ccef8f70e5b1 100644 --- 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 @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.1_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.1_DCC.xml" } */ import { DCCDocument, ItemType } from "../../../src"; @@ -9,7 +8,7 @@ describe("GP_Temperature_v3.2.1_DCC: ItemType", () => { let dcc: DCCDocument, item: ItemType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); item = dcc.digitalCalibrationCertificate.administrativeData.items.item[0]; }); diff --git a/tests/DCC/GP_Temperatur_v3.2.1_DCC/AdministrativeData.Items.test.ts b/tests/DCC/GP_Temperatur_v3.2.1_DCC/AdministrativeData.Items.test.ts index 632535f130bf241bb3c37b936eef7d82bded6a6c..ac03d0992b4136d55c2b4010ffdc7499e05c5215 100644 --- a/tests/DCC/GP_Temperatur_v3.2.1_DCC/AdministrativeData.Items.test.ts +++ b/tests/DCC/GP_Temperatur_v3.2.1_DCC/AdministrativeData.Items.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.1_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.1_DCC.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -21,7 +20,7 @@ describe("GP_Temperature_v3.2.1_DCC: ItemListType", () => { let dcc: DCCDocument, items: ItemListType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); items = dcc.digitalCalibrationCertificate.administrativeData.items; }); diff --git a/tests/DCC/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts b/tests/DCC/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts index 5f4974e098b7cc3e680620749119b8e80564009e..4607750ebd7e282fba78bbc843e55aa92f52ffb0 100644 --- a/tests/DCC/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts +++ b/tests/DCC/MeasurementResults.MeasurementResult.InfluenceConditions.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/example.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/example.xml" } */ import { select, toTextArr, toTextContentArr } from "../util"; @@ -103,7 +102,7 @@ describe("InfluenceConditionListType", () => { let dcc: DCCDocument, influenceConditions: InfluenceConditionListType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); influenceConditions = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].influenceConditions; }); diff --git a/tests/DCC/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts b/tests/DCC/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts index 8107d84f5dc32f4465bc300425f321f8730d1b25..187b54dffa56f36033d4fa1a476f5fab06e1f0b6 100644 --- a/tests/DCC/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts +++ b/tests/DCC/MeasurementResults.MeasurementResult.MeasuringEquipments.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/example.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/example.xml" } */ import { select, toTextArr, toTextContentArr } from "../util"; @@ -28,7 +27,7 @@ describe("MeasuringEquipmentType", () => { let dcc: DCCDocument, measuringEquipment: MeasuringEquipmentType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); measuringEquipment = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].measuringEquipments.measuringEquipment[0]; }); diff --git a/tests/DCC/MeasurementResults.MeasurementResult.Name.test.ts b/tests/DCC/MeasurementResults.MeasurementResult.Name.test.ts index 1828f271221c07be3aaa1a5c79286e7055fb8a9a..1dc5e99de4462b8dde55f91efb24c3d390ba6e4a 100644 --- a/tests/DCC/MeasurementResults.MeasurementResult.Name.test.ts +++ b/tests/DCC/MeasurementResults.MeasurementResult.Name.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/example.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/example.xml" } */ import { select, toTextArr, toTextContentArr } from "../util"; @@ -21,7 +20,7 @@ describe("MeasurementResultType", () => { let dcc: DCCDocument, measurementResult: MeasurementResultType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); measurementResult = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0]; }); diff --git a/tests/DCC/MeasurementResults.MeasurementResult.Results.test.ts b/tests/DCC/MeasurementResults.MeasurementResult.Results.test.ts index 64536b72f53101592e11e8d4f14834228e45e993..39e6b5e89e8bb4a24d06ec0971e4fa8bf3d56a17 100644 --- a/tests/DCC/MeasurementResults.MeasurementResult.Results.test.ts +++ b/tests/DCC/MeasurementResults.MeasurementResult.Results.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/example.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/example.xml" } */ import { select, toTextArr, toTextContentArr } from "../util"; @@ -101,7 +100,7 @@ describe("ResultType", () => { let dcc: DCCDocument, result: ResultType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); result = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].results.result[0]; }); diff --git a/tests/DCC/MeasurementResults.MeasurementResult.UsedMethods.test.ts b/tests/DCC/MeasurementResults.MeasurementResult.UsedMethods.test.ts index 54cdf56cceaf723e030a79ae1d54a48ec65512ec..cb502b6d37e5a141f2b33e12421123284ebc12c7 100644 --- a/tests/DCC/MeasurementResults.MeasurementResult.UsedMethods.test.ts +++ b/tests/DCC/MeasurementResults.MeasurementResult.UsedMethods.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/example.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/example.xml" } */ import { select, toTextArr, toTextContentArr } from "../util"; @@ -39,7 +38,7 @@ describe("UsedMethodListType", () => { let dcc: DCCDocument, usedMethods: UsedMethodListType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); usedMethods = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].usedMethods; }); diff --git a/tests/DCC/Test_DCC_Minimal/AdministrativeData.CalibrationLaboratory.test.ts b/tests/DCC/Test_DCC_Minimal/AdministrativeData.CalibrationLaboratory.test.ts index 3529e3bb4a840102afa02c84f3c0b14a5eb4e18c..43fc202a1a4b6443cc1fe46e4caa95aebb269b7a 100644 --- a/tests/DCC/Test_DCC_Minimal/AdministrativeData.CalibrationLaboratory.test.ts +++ b/tests/DCC/Test_DCC_Minimal/AdministrativeData.CalibrationLaboratory.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/Test_DCC_Minimal.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/Test_DCC_Minimal.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -18,7 +17,7 @@ describe("Test_DCC_Minimal: CalibrationLaboratoryType", () => { let dcc: DCCDocument, calibrationLaboratory: CalibrationLaboratoryType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); calibrationLaboratory = dcc.digitalCalibrationCertificate.administrativeData.calibrationLaboratory; }); diff --git a/tests/DCC/Test_DCC_Minimal/AdministrativeData.CoreDataType.test.ts b/tests/DCC/Test_DCC_Minimal/AdministrativeData.CoreDataType.test.ts index e9ca47c8bc52429a1de605146f3103c6c69b2f2b..758923e3726f8082278446629d22c0e73b415544 100644 --- a/tests/DCC/Test_DCC_Minimal/AdministrativeData.CoreDataType.test.ts +++ b/tests/DCC/Test_DCC_Minimal/AdministrativeData.CoreDataType.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/Test_DCC_Minimal.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/Test_DCC_Minimal.xml" } */ import * as fc from "fast-check"; @@ -34,7 +33,7 @@ describe("Test_DCC_Minimal: CoreDataType", () => { let dcc: DCCDocument, coreData: CoreDataType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); coreData = dcc.digitalCalibrationCertificate.administrativeData.coreData; }); diff --git a/tests/DCC/Test_DCC_Minimal/AdministrativeData.Customer.test.ts b/tests/DCC/Test_DCC_Minimal/AdministrativeData.Customer.test.ts index 3888155b720d702e35bd3514808193b9d2da53a4..c0604059b2775a655465f97ee21595a69152a64d 100644 --- a/tests/DCC/Test_DCC_Minimal/AdministrativeData.Customer.test.ts +++ b/tests/DCC/Test_DCC_Minimal/AdministrativeData.Customer.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/Test_DCC_Minimal.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/Test_DCC_Minimal.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -22,7 +21,7 @@ describe("Test_DCC_Minimal: ContactType", () => { let dcc: DCCDocument, customer: ContactType, location: LocationType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); customer = dcc.digitalCalibrationCertificate.administrativeData.customer; location = customer.location; /* TODO: check iff this variable is used anywhere */ }); diff --git a/tests/DCC/Test_DCC_Minimal/AdministrativeData.Items.test.ts b/tests/DCC/Test_DCC_Minimal/AdministrativeData.Items.test.ts index 958427c0ab62110e1b13ea66ff68257190bbbe55..0479cb516055ab69b3bb966cd9a91a478f7f981f 100644 --- a/tests/DCC/Test_DCC_Minimal/AdministrativeData.Items.test.ts +++ b/tests/DCC/Test_DCC_Minimal/AdministrativeData.Items.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/Test_DCC_Minimal.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/Test_DCC_Minimal.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -35,7 +34,7 @@ describe("Test_DCC_Minimal: ItemType", () => { let dcc: DCCDocument, item: ItemType, identification: IdentificationType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); item = dcc.digitalCalibrationCertificate.administrativeData.items.item[0]; identification = item.identifications.identification[0]; }); diff --git a/tests/DCC/Test_DCC_Minimal/AdministrativeData.RespPersons.test.ts b/tests/DCC/Test_DCC_Minimal/AdministrativeData.RespPersons.test.ts index 7c74d6156dfb6a3ae2931778af04438753cdfcd9..3587b34928a61ffdc16fe53de7fcbac205fdac4c 100644 --- a/tests/DCC/Test_DCC_Minimal/AdministrativeData.RespPersons.test.ts +++ b/tests/DCC/Test_DCC_Minimal/AdministrativeData.RespPersons.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/Test_DCC_Minimal.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/Test_DCC_Minimal.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -23,7 +22,7 @@ describe("Test_DCC_Minimal: RespPersonType", () => { let dcc: DCCDocument, respPerson: RespPersonType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); respPerson = dcc.digitalCalibrationCertificate.administrativeData.respPersons.respPerson[0]; }); diff --git a/tests/DCC/Test_DCC_Minimal/AdministrativeData.SoftwareListType.test.ts b/tests/DCC/Test_DCC_Minimal/AdministrativeData.SoftwareListType.test.ts index 3577e44e913907b500a88a8880a88217d1cd4bf8..cacf9e41cc3dd7d02969528177dcd784849c1109 100644 --- a/tests/DCC/Test_DCC_Minimal/AdministrativeData.SoftwareListType.test.ts +++ b/tests/DCC/Test_DCC_Minimal/AdministrativeData.SoftwareListType.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/Test_DCC_Minimal.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/Test_DCC_Minimal.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -24,7 +23,7 @@ describe("Test_DCC_Minimal: DccSoftwareType", () => { let dcc: DCCDocument, dccSoftware: SoftwareListType, software: SoftwareType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); dccSoftware = dcc.digitalCalibrationCertificate.administrativeData.dccSoftware; software = dccSoftware.software[0]; }); diff --git a/tests/DCC/Test_DCC_Minimal/DigitalCalibrationCertificateType.test.ts b/tests/DCC/Test_DCC_Minimal/DigitalCalibrationCertificateType.test.ts index 1f0006a2ed27ebe21d73110cd8b29b3c318c7e14..ef827323cad0b9a5bca0e55715bc2722184893fa 100644 --- a/tests/DCC/Test_DCC_Minimal/DigitalCalibrationCertificateType.test.ts +++ b/tests/DCC/Test_DCC_Minimal/DigitalCalibrationCertificateType.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/Test_DCC_Minimal.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/Test_DCC_Minimal.xml" } */ import { select } from "../../util"; @@ -11,7 +10,7 @@ describe("Test_DCC_Minimal: DigitalCalibrationCertificateType", () => { let xml, dcc, dom; beforeEach(() => { - ({ xml, dcc, dom } = xmlEnv.recreateEnv()); + ({ xml, dcc, dom } = recreateEnv()); }); test("should get correct schemaVersion from XML", () => { diff --git a/tests/DCC/Test_DCC_Minimal/MeasurementResults.MeasurementResult.Name.test.ts b/tests/DCC/Test_DCC_Minimal/MeasurementResults.MeasurementResult.Name.test.ts index bd50cc089aebd932d39b73b02bea3d9baea30f7a..ec2478b768078045975f7a7a1fa75602eb54382b 100644 --- a/tests/DCC/Test_DCC_Minimal/MeasurementResults.MeasurementResult.Name.test.ts +++ b/tests/DCC/Test_DCC_Minimal/MeasurementResults.MeasurementResult.Name.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/Test_DCC_Minimal.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/Test_DCC_Minimal.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -21,7 +20,7 @@ describe("Test_DCC_Minimal: MeasurementResultType", () => { let dcc: DCCDocument, measurementResult: MeasurementResultType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); measurementResult = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0]; }); diff --git a/tests/DCC/Test_DCC_Minimal/MeasurementResults.MeasurementResult.Results.test.ts b/tests/DCC/Test_DCC_Minimal/MeasurementResults.MeasurementResult.Results.test.ts index 06a09732589d26bcc61678da2d4b5ccd2bce0529..4e6f9a02c32c17dac31f0a73bf7037888db31f86 100644 --- a/tests/DCC/Test_DCC_Minimal/MeasurementResults.MeasurementResult.Results.test.ts +++ b/tests/DCC/Test_DCC_Minimal/MeasurementResults.MeasurementResult.Results.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/Test_DCC_Minimal.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/Test_DCC_Minimal.xml" } */ import { select, toTextArr, toTextContentArr } from "../../util"; @@ -48,7 +47,7 @@ describe("Test_DCC_Minimal: ResultType", () => { let dcc: DCCDocument, result: ResultType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); result = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].results.result[0]; }); diff --git a/tests/DCC/common/AdministrativeData/CalibrationLaboratory.ts b/tests/DCC/common/AdministrativeData/CalibrationLaboratory.ts index 25a455dc9475d0b92e64831ceaade2fbc96df271..a6afc21a73416a6d7c5d302c478678b057cbb320 100644 --- a/tests/DCC/common/AdministrativeData/CalibrationLaboratory.ts +++ b/tests/DCC/common/AdministrativeData/CalibrationLaboratory.ts @@ -23,7 +23,7 @@ export const testCalibrationLaboratory = () => { let dcc: DCCDocument, calibrationLaboratory: CalibrationLaboratoryType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); calibrationLaboratory = dcc.digitalCalibrationCertificate.administrativeData.calibrationLaboratory; }); diff --git a/tests/DCC/common/AdministrativeData/CoreDataType.ts b/tests/DCC/common/AdministrativeData/CoreDataType.ts index ea974a5eea0dcdea35887302742d9576a470805f..279e2a037d9fba2dce33b07a4720d8da33092047 100644 --- a/tests/DCC/common/AdministrativeData/CoreDataType.ts +++ b/tests/DCC/common/AdministrativeData/CoreDataType.ts @@ -31,7 +31,7 @@ export const testCoreData = () => { let dcc: DCCDocument, coreData: CoreDataType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); coreData = dcc.digitalCalibrationCertificate.administrativeData.coreData; }); diff --git a/tests/DCC/common/AdministrativeData/RespPersons.ts b/tests/DCC/common/AdministrativeData/RespPersons.ts index 88495a0fa0a5f732239ccebb886b05859e5700d0..79ce09c35889ac4e55c1896b3c3609eb6f72f904 100644 --- a/tests/DCC/common/AdministrativeData/RespPersons.ts +++ b/tests/DCC/common/AdministrativeData/RespPersons.ts @@ -7,7 +7,7 @@ const xpath = { }; export const testRespPersonListType = () => { describe("RespPersonListType", () => { - const { dom } = xmlEnv.recreateEnv(); + const { dom } = recreateEnv(); const expectedRespPersons = <Element[]>select(xpath.respPerson, dom); for (let i = 0; i < expectedRespPersons.length; i++) { diff --git a/tests/DCC/common/Types/ContactType.ts b/tests/DCC/common/Types/ContactType.ts index 07b0d211bf3cc99765372ba07df0610b9b7fc1de..1428d9fb62c2f1f93cfbb8c319b653336db849d4 100644 --- a/tests/DCC/common/Types/ContactType.ts +++ b/tests/DCC/common/Types/ContactType.ts @@ -30,7 +30,7 @@ export const testContactType = (base: string, contactTypeFn: (dcc: DCCDocument) let dcc: DCCDocument, contactType: ContactType | ContactNotStrictType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); contactType = contactTypeFn(dcc); }); diff --git a/tests/DCC/common/Types/DataType.ts b/tests/DCC/common/Types/DataType.ts index e39bb763451c9ac85c21bfd5f6a15deb3ce277b4..86ac66b56a9fd0db0578218eb8d6d890bad3cf0e 100644 --- a/tests/DCC/common/Types/DataType.ts +++ b/tests/DCC/common/Types/DataType.ts @@ -12,10 +12,11 @@ export const testDataType = (base: string, dataTypeFn: (dcc: DCCDocument) => Dat let dcc: DCCDocument, dataType: DataType, dom; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); dataType = dataTypeFn(dcc); }); + // eslint-disable-next-line @typescript-eslint/no-empty-function test("noop", () => {}); // TODO(Statement): quantity with real diff --git a/tests/DCC/common/Types/RespPersonType.ts b/tests/DCC/common/Types/RespPersonType.ts index 4284f9e9e59961d673eac1ffff77204c9eb6adee..13064d4355a787982b0b03256e2d4ace5f30f43a 100644 --- a/tests/DCC/common/Types/RespPersonType.ts +++ b/tests/DCC/common/Types/RespPersonType.ts @@ -10,10 +10,10 @@ export const testRespPersonType = (base: string, respPersonTypeFn: (dcc: DCCDocu describe("RespPersonType", () => { let dcc: DCCDocument, respPersonType: RespPersonType, dom; - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); respPersonType = respPersonTypeFn(dcc); }); diff --git a/tests/DCC/common/Types/StatementListType.ts b/tests/DCC/common/Types/StatementListType.ts index 254fda4055e15b176321814056dbf7cc918a6641..09b54e06893ec55fd560a9f5dc46e099db69878b 100644 --- a/tests/DCC/common/Types/StatementListType.ts +++ b/tests/DCC/common/Types/StatementListType.ts @@ -8,7 +8,7 @@ export const testStatementListType = (base, statementListTypeFn: (dcc: DCCDocume }; describe("StatementListType", () => { - const { dom } = xmlEnv.recreateEnv(); + const { dom } = recreateEnv(); const expectedStatements = <Element[]>select(xpath.statement, dom); for (let i = 0; i < expectedStatements.length; i++) { diff --git a/tests/DCC/common/Types/StatementMetaDataType.ts b/tests/DCC/common/Types/StatementMetaDataType.ts index 5e09d863652e38288590ea89d2124ffe2b5a7383..3ec8b7d6fbc6a3d3cc0f3004404f4feb360af5b4 100644 --- a/tests/DCC/common/Types/StatementMetaDataType.ts +++ b/tests/DCC/common/Types/StatementMetaDataType.ts @@ -20,10 +20,10 @@ export const testStatementMetaDataType = (name, base: string, statementMetaDataT describe(`StatementMetaDataType ${name}`, () => { let dcc: DCCDocument, statementMetaDataType: StatementMetaDataType, dom; - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); statementMetaDataType = statementMetaDataTypeFn(dcc); }); diff --git a/tests/DCCDocument.test.ts b/tests/DCCDocument.test.ts index 06dccbf35bc53914da529ad3169ca413a3713a38..8ad62d175fa9d659a9e31ef7843c8b975dcb62ab 100644 --- a/tests/DCCDocument.test.ts +++ b/tests/DCCDocument.test.ts @@ -1,13 +1,12 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/example.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/example.xml" } */ describe("DCCDocument", () => { let xml, dcc; beforeEach(() => { - ({ xml, dcc } = xmlEnv.recreateEnv()); + ({ xml, dcc } = recreateEnv()); }); test("fromXml() and toXml() should not modify XML", () => { diff --git a/tests/GP_Temperature/CharsXMLList.test.ts b/tests/GP_Temperature/CharsXMLList.test.ts index ac10b24c8bb6ea5acfc581e0768b5c9e7e30f008..1d0f83cd795e069fdb7f6504452db195a373591b 100644 --- a/tests/GP_Temperature/CharsXMLList.test.ts +++ b/tests/GP_Temperature/CharsXMLList.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select } from "../util"; @@ -15,7 +14,7 @@ describe("CharsXMLList", () => { let dcc: DCCDocument, dom, result; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); result = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].results.result[0]; }); diff --git a/tests/GP_Temperature/noQuantity.test.ts b/tests/GP_Temperature/noQuantity.test.ts index 8b8bc095dfebd32e594f79bacf4ab83106840592..4eec495d4b3eaafe46b6dda4756dd9ac6b14f206 100644 --- a/tests/GP_Temperature/noQuantity.test.ts +++ b/tests/GP_Temperature/noQuantity.test.ts @@ -1,6 +1,5 @@ /** - * @jest-environment ./tests/XMLEnvironment.ts - * @xml ./tests/resources/GP_Temperature_v3.2.0_DCC.xml + * @vitest-environment-options { "xmlPath": "./tests/resources/GP_Temperature_v3.2.0_DCC.xml" } */ import { select, toTextArr, toTextContentArr } from "../util"; @@ -28,7 +27,7 @@ describe("noQuantity", () => { let dcc: DCCDocument, dom, result; beforeEach(() => { - ({ dcc, dom } = xmlEnv.recreateEnv()); + ({ dcc, dom } = recreateEnv()); result = dcc.digitalCalibrationCertificate.measurementResults.measurementResult[0].results.result[0]; }); diff --git a/tests/XMLEnvironment.ts b/tests/XMLEnvironment.ts deleted file mode 100644 index 10160dec3084e38d0a56f4aef1bbe4e3a61e9f99..0000000000000000000000000000000000000000 --- a/tests/XMLEnvironment.ts +++ /dev/null @@ -1,44 +0,0 @@ -import * as fs from "fs/promises"; -import { DCCDocument } from "../src"; -import NodeEnvironment from "jest-environment-node"; -import { JSDOM } from "jsdom"; - -export default class XMLEnvironment extends NodeEnvironment { - xmlPath: string; - xml: string; - - constructor(config, context) { - super(config, context); - const xmlPath = context.docblockPragmas["xml"]; - if (xmlPath && typeof xmlPath === "string") { - this.xmlPath = xmlPath; - } - } - - async setup() { - await super.setup(); - if (this.xmlPath) { - this.xml = await this.readFile(this.xmlPath); - } - this.global.xmlEnv = this; - } - - recreateEnv(): { xml: string; dcc: DCCDocument; dom: JSDOM } { - return { - xml: this.xml, - dcc: this.xml ? DCCDocument.fromXml(this.xml) : DCCDocument.createEmpty(), - dom: new JSDOM(this.xml, { contentType: "application/xml" }), - }; - } - - async readFile(path: string) { - // check if file exists - if ((await fs.stat(path)).isFile()) { - return await fs.readFile(path, { encoding: "utf-8" }); - } else { - throw new Error(`File ${path} does not exist.`); - } - } -} - -export const TestEnvironment = XMLEnvironment; diff --git a/tests/index.d.ts b/tests/index.d.ts deleted file mode 100644 index facbc06803c5991082187188c3fe4ea62972402a..0000000000000000000000000000000000000000 --- a/tests/index.d.ts +++ /dev/null @@ -1,12 +0,0 @@ -import XMLEnvironment from "./XMLEnvironment"; - -declare let xmlEnv: XMLEnvironment; - -declare global { - let xmlEnv: XMLEnvironment; - namespace NodeJS { - interface Global { - xmlEnv: XMLEnvironment; - } - } -} diff --git a/tests/tsconfig.json b/tests/tsconfig.json index e6db6f1651e18a64c8d6e026b0d5510d56f15960..564b6240571b0e8e8739940f34e310dda8116062 100644 --- a/tests/tsconfig.json +++ b/tests/tsconfig.json @@ -2,9 +2,7 @@ "compilerOptions": { "target": "ES6", "declaration": true, - "module": "commonjs" - }, - "files": [ - "./index.d.ts" - ] + "module": "commonjs", + "types": ["vitest/globals"] + } } diff --git a/tests/vitest-environment-custom/index.ts b/tests/vitest-environment-custom/index.ts new file mode 100644 index 0000000000000000000000000000000000000000..c01dccf09bff238ff541b7d80ab987fa5049d3f0 --- /dev/null +++ b/tests/vitest-environment-custom/index.ts @@ -0,0 +1,48 @@ +import * as fs from "fs/promises"; +import { DCCDocument } from "../../src"; +import type { Environment } from "vitest"; +import { JSDOM } from "jsdom"; +import { builtinEnvironments } from "vitest/environments"; + +declare global { + function recreateEnv(): { xml: string; dcc: DCCDocument; dom: JSDOM }; +} + +type Options = { + custom: { + xmlPath: string; + }; +}; + +async function readFile(path: string) { + // check if file exists + if ((await fs.stat(path)).isFile()) { + return await fs.readFile(path, { encoding: "utf-8" }); + } else { + throw new Error(`File ${path} does not exist.`); + } +} + +export default <Environment>{ + name: "custom", + async setup(global, { custom }: Options) { + const env = builtinEnvironments["node"]; + const envReturn = await env.setup(global, {}); + + const xml = await readFile(custom.xmlPath); + global.recreateEnv = (): { xml: string; dcc: DCCDocument; dom: JSDOM } => { + return { + xml, + dcc: xml ? DCCDocument.fromXml(xml) : DCCDocument.createEmpty(), + dom: new JSDOM(xml, { contentType: "application/xml" }), + }; + }; + + return { + async teardown(global) { + delete global.recreateEnv; + await envReturn.teardown(global); + }, + }; + }, +}; diff --git a/tests/vitest-environment-custom/package.json b/tests/vitest-environment-custom/package.json new file mode 100644 index 0000000000000000000000000000000000000000..a3717c6dbe2a4f98528f65a5602b1a1778106c7b --- /dev/null +++ b/tests/vitest-environment-custom/package.json @@ -0,0 +1,5 @@ +{ + "name": "vitest-environment-custom", + "private": true, + "main": "index.ts" +} diff --git a/tsconfig.json b/tsconfig.json index c5294d3dc9ae637e2b6e97cb6838cd9eefc848f4..3b65aca61ef5fd4e36c382d19cf6464f379596ad 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,7 +4,7 @@ "module": "commonjs", "declaration": true, "sourceMap": true, - "outDir": "./lib", + "outDir": "./lib" }, "include": [ "src" diff --git a/vite.config.ts b/vite.config.ts new file mode 100644 index 0000000000000000000000000000000000000000..8473f6815897b272e51007c01817fe460a86d120 --- /dev/null +++ b/vite.config.ts @@ -0,0 +1,23 @@ +/// <reference types="vitest" /> + +import { defineConfig } from "vite"; +import AutoImport from "unplugin-auto-import/vite"; + +export default defineConfig({ + plugins: [ + AutoImport({ + imports: ["vitest"], + dts: true, // generate TypeScript declaration + }), + ], + test: { + globals: true, + environment: "custom", + reporters: ["default", "junit"], + outputFile: "junit.xml", + coverage: { + provider: "istanbul", + reporter: ["text-summary", "cobertura"], + }, + }, +}); diff --git a/yarn.lock b/yarn.lock index 57b5e4e98b2ffb46897ec2bb54de824096681d8a..73ae83801f85034343d96fab25c7da0d9b2a337a 100644 Binary files a/yarn.lock and b/yarn.lock differ