Fix tests
This commit is contained in:
@ -44,7 +44,6 @@ const convertedXmlElement = {
|
||||
],
|
||||
},
|
||||
],
|
||||
rootKey: undefined,
|
||||
};
|
||||
|
||||
describe("ImportedXmlComponent", () => {
|
||||
@ -63,7 +62,7 @@ describe("ImportedXmlComponent", () => {
|
||||
it("should transform for xml", () => {
|
||||
// tslint:disable-next-line: no-object-literal-type-assertion
|
||||
const converted = importedXmlComponent.prepForXml({ stack: [] } as unknown as IContext);
|
||||
expect(converted).to.deep.equal({
|
||||
expect(JSON.parse(JSON.stringify(converted))).to.deep.equal({
|
||||
"w:test": [
|
||||
{
|
||||
_attr: {
|
||||
@ -81,14 +80,14 @@ describe("ImportedXmlComponent", () => {
|
||||
|
||||
it("should create XmlComponent from xml string", () => {
|
||||
const converted = ImportedXmlComponent.fromXmlString(xmlString);
|
||||
expect(converted).to.deep.equal(convertedXmlElement);
|
||||
expect(JSON.parse(JSON.stringify(converted))).to.deep.equal(convertedXmlElement);
|
||||
});
|
||||
|
||||
describe("convertToXmlComponent", () => {
|
||||
it("should convert to xml component", () => {
|
||||
const xmlObj = xml2js(xmlString, { compact: false }) as Element;
|
||||
const converted = convertToXmlComponent(xmlObj);
|
||||
expect(converted).to.deep.equal(convertedXmlElement);
|
||||
expect(JSON.parse(JSON.stringify(converted))).to.deep.equal(convertedXmlElement);
|
||||
});
|
||||
|
||||
it("should return undefined if xml type is invalid", () => {
|
||||
|
Reference in New Issue
Block a user