#1507 - Add scale for run

This commit is contained in:
Dolan
2022-11-03 00:30:16 +00:00
parent b9ceabcc07
commit 1b06fc71cf
15 changed files with 110 additions and 75 deletions

View File

@ -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: {},
});
});
});
});