diff --git a/src/file/styles/external-styles-factory.spec.ts b/src/file/styles/external-styles-factory.spec.ts index 3bd26e94b8..34aeb0f069 100644 --- a/src/file/styles/external-styles-factory.spec.ts +++ b/src/file/styles/external-styles-factory.spec.ts @@ -61,7 +61,7 @@ describe("External styles factory", () => { it("should parse other child elements of w:styles", () => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const importedStyle = new ExternalStylesFactory().newInstance(externalStyles) as any; - expect(importedStyle.root[1]).to.deep.equal({ + expect(JSON.parse(JSON.stringify(importedStyle.root[1]))).to.deep.equal({ root: [ { root: [ @@ -126,7 +126,7 @@ describe("External styles factory", () => { ], rootKey: "w:docDefaults", }); - expect(importedStyle.root[2]).to.deep.equal({ + expect(JSON.parse(JSON.stringify(importedStyle.root[2]))).to.deep.equal({ root: [ { root: { @@ -151,7 +151,7 @@ describe("External styles factory", () => { const importedStyle = new ExternalStylesFactory().newInstance(externalStyles) as any; expect(importedStyle.root.length).to.equal(5); - expect(importedStyle.root[3]).to.deep.equal({ + expect(JSON.parse(JSON.stringify(importedStyle.root[3]))).to.deep.equal({ root: [ { root: { @@ -180,7 +180,7 @@ describe("External styles factory", () => { rootKey: "w:style", }); - expect(importedStyle.root[4]).to.deep.equal({ + expect(JSON.parse(JSON.stringify(importedStyle.root[4]))).to.deep.equal({ root: [ { root: { diff --git a/src/file/xml-components/imported-xml-component.spec.ts b/src/file/xml-components/imported-xml-component.spec.ts index ebf61ad7b3..444e323a6c 100644 --- a/src/file/xml-components/imported-xml-component.spec.ts +++ b/src/file/xml-components/imported-xml-component.spec.ts @@ -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", () => {