#1507 - Add scale for run
This commit is contained in:
@ -3,7 +3,7 @@ import { Element, xml2js } from "xml-js";
|
||||
|
||||
import { EMPTY_OBJECT } from "@file/xml-components";
|
||||
|
||||
import { convertToXmlComponent, ImportedXmlComponent } from "./imported-xml-component";
|
||||
import { convertToXmlComponent, ImportedRootElementAttributes, ImportedXmlComponent } from "./imported-xml-component";
|
||||
import { IContext } from "./base";
|
||||
|
||||
const xmlString = `
|
||||
@ -90,5 +90,29 @@ describe("ImportedXmlComponent", () => {
|
||||
const converted = convertToXmlComponent(xmlObj);
|
||||
expect(converted).to.deep.equal(convertedXmlElement);
|
||||
});
|
||||
|
||||
it("should return undefined if xml type is invalid", () => {
|
||||
const xmlObj = { type: "invalid" } as Element;
|
||||
const converted = convertToXmlComponent(xmlObj);
|
||||
expect(converted).to.equal(undefined);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe("ImportedRootElementAttributes", () => {
|
||||
let attributes: ImportedRootElementAttributes;
|
||||
|
||||
beforeEach(() => {
|
||||
attributes = new ImportedRootElementAttributes({});
|
||||
});
|
||||
|
||||
describe("#prepForXml()", () => {
|
||||
it("should work", () => {
|
||||
// tslint:disable-next-line: no-object-literal-type-assertion
|
||||
const converted = attributes.prepForXml({} as IContext);
|
||||
expect(converted).to.deep.equal({
|
||||
_attr: {},
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
||||
|
Reference in New Issue
Block a user