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

test: added tests for ad respPersons

parent b576567e
No related branches found
No related tags found
3 merge requests!10Refactor Test Resources,!6Adaptations for new DCC V3.2.1,!5Add tests
Pipeline #19247 passed
/**
* @jest-environment ./tests/XMLEnvironment.ts
* @xml ./tests/resources/example.xml
*/
import { select, toTextArr, toTextContentArr } from "../util";
import { RespPersonType, DCCDocument } from "../../src";
const base = "//dcc:administrativeData/dcc:respPersons";
const xpath = {
respPersons: {
respPerson: {
person: {
name: {
content: `${base}/dcc:respPerson[1]/dcc:person/dcc:name/dcc:content`,
},
},
mainSigner: `string(${base}/dcc:respPerson[1]/dcc:mainSigner)`,
},
},
};
describe("ContactType", () => {
let dcc: DCCDocument, respPerson: RespPersonType, dom;
beforeEach(async () => {
({ dcc, dom } = await xmlEnv.recreateEnv());
respPerson = dcc.digitalCalibrationCertificate.administrativeData.respPersons.respPerson[0];
});
test("should get correct res name content from XML", () => {
// get expected list from example xml
const expected = <Element[]>select(xpath.respPersons.respPerson.person.name.content, dom);
expect(toTextArr(respPerson.person.name.content)).toEqual(toTextContentArr(expected));
});
test("should get correct responsible person main signer flag from XML", () => {
expect(respPerson.mainSigner._text).toBe(select(xpath.respPersons.respPerson.mainSigner, dom));
});
/* TODO: setters */
});
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment