typescriptify and cleanup

This commit is contained in:
Dror Gluska
2019-05-31 11:27:48 +03:00
parent 28006be580
commit cfebc962f0
28 changed files with 2863 additions and 1845 deletions

View File

@@ -0,0 +1,30 @@
import fs from "fs";
import "mocha";
import should from "should";
import stream from "stream";
import zlib from "zlib";
import { XmlParser } from "../src/parser";
describe("CData and comments in xml", () => {
it("should properly parse a simple file.", (done) => {
const xmlStream = fs.createReadStream("./test/TestFiles/CData-comments.xml");
const parser = new XmlParser({ resourcePath: "/items/item" });
let dataEventCount = 0;
parser.on("data", (data) => {
dataEventCount++;
});
parser.on("error", (err) => {
done(err);
});
parser.on("end", () => {
// console.log('dataEventCount=', dataEventCount)
should(dataEventCount).equal(296);
done();
});
xmlStream.pipe(parser);
});
});