Skip to content
Snippets Groups Projects

Add tests

Merged Jan Loewe requested to merge feat-jest-tests into master
1 file
+ 7
3
Compare changes
  • Side-by-side
  • Inline
@@ -3,13 +3,15 @@
* @xml ./tests/resources/GP_Temperature_Complete_DCC.xml
*/
import { select } from "../util";
import { select, toTextArr, toTextContentArr } from "../util";
import { DCCDocument } from "../../src";
const base = "//dcc:quantity[@refType='test_noQuantity']/dcc:noQuantity";
const xpath = {
noQuantity: {
name: `string(${base}/dcc:name)`,
name: {
content: `string(${base}/dcc:name/dcc:content)`,
},
content: `string(${base}/dcc:content)`,
file: {
fileName: `string(${base}/dcc:file/dcc:fileName)`,
@@ -31,7 +33,9 @@ describe("noQuantity", () => {
});
test("should get correct name from XML", () => {
expect(result.data.quantity[0].noQuantity.name._text).toBe(select(xpath.noQuantity.name, dom));
const expected = <Element[]>select(xpath.noQuantity.name.content, dom);
expect(toTextArr(result.data.quantity[0].noQuantity.name.content)[0]).toBe(expected);
});
test("should get correct content from XML", () => {
Loading