|
@@ -1,37 +1,5 @@
|
|
|
-import {IXmlElement} from "../../../src/Common/FileIO/Xml";
|
|
|
-import JSZip = require("jszip");
|
|
|
-// typings for JSZip module
|
|
|
-// type JSZip = any;
|
|
|
-// declare var JSZip: any;
|
|
|
-
|
|
|
-function extractSheetFromMxl(data: string): any {
|
|
|
- "use strict";
|
|
|
- // let buf = Buffer.concat(data);
|
|
|
- let zip: any = new JSZip();
|
|
|
-
|
|
|
- return zip.loadAsync(data).then((_: any) => {
|
|
|
- return zip.file("META-INF/container.xml").async("string");
|
|
|
- }).then((content: string) => {
|
|
|
- let parser: DOMParser = new DOMParser();
|
|
|
- let doc: Document = parser.parseFromString(content, "text/xml");
|
|
|
- console.log(content);
|
|
|
- // doc.Root.Element("rootfiles").Element("rootfile").Attribute("full-path").Value;
|
|
|
- let rootFile: string = doc.getElementsByTagName("rootfile")[0].getAttribute("full-path");
|
|
|
- console.log("success..", rootFile);
|
|
|
- return zip.file(rootFile).async("string");
|
|
|
- }).then(
|
|
|
- (content: string) => {
|
|
|
- console.log("success...", content);
|
|
|
- let parser: DOMParser = new DOMParser();
|
|
|
- let doc: Document = parser.parseFromString(content, "text/xml");
|
|
|
- console.log("success...", doc);
|
|
|
- return new IXmlElement(doc.documentElement);
|
|
|
- },
|
|
|
- (reason: any) => {
|
|
|
- chai.assert.fail(0, 1, reason.message);
|
|
|
- }
|
|
|
- );
|
|
|
-}
|
|
|
+import { IXmlElement } from "../../../src/Common/FileIO/Xml";
|
|
|
+import { extractSheetFromMxl } from "../../../src/Common/FileIO/Mxl.ts";
|
|
|
|
|
|
describe("MXL Tests", () => {
|
|
|
// Initialize variables
|
|
@@ -48,7 +16,7 @@ describe("MXL Tests", () => {
|
|
|
let mxl: string = getSheet(path);
|
|
|
chai.expect(mxl).to.not.be.undefined;
|
|
|
extractSheetFromMxl(mxl).then(
|
|
|
- (elem: any) => {
|
|
|
+ (elem: IXmlElement) => {
|
|
|
console.log("success!", elem);
|
|
|
},
|
|
|
(reason: any) => {
|