2017-03-13 00:02:56 +00:00
|
|
|
import { assert } from "chai";
|
2017-04-01 12:30:27 +01:00
|
|
|
import * as fs from "fs";
|
2017-03-12 23:32:02 +00:00
|
|
|
import { Drawing } from "../../../../docx/run/run-components/drawing";
|
|
|
|
import { Utility } from "../../../utility";
|
|
|
|
|
2017-04-01 12:30:27 +01:00
|
|
|
describe("Drawing", () => {
|
2017-03-12 23:32:02 +00:00
|
|
|
let currentBreak: Drawing;
|
|
|
|
|
|
|
|
beforeEach(() => {
|
2017-04-01 12:30:27 +01:00
|
|
|
const path = "./demo/penguins.jpg";
|
|
|
|
currentBreak = new Drawing({
|
|
|
|
fileName: "test.jpg",
|
|
|
|
referenceId: 1,
|
|
|
|
stream: fs.createReadStream(path),
|
|
|
|
path: path,
|
|
|
|
});
|
2017-03-12 23:32:02 +00:00
|
|
|
});
|
|
|
|
|
|
|
|
describe("#constructor()", () => {
|
|
|
|
it("should create a Drawing with correct root key", () => {
|
|
|
|
const newJson = Utility.jsonify(currentBreak);
|
|
|
|
assert.equal(newJson.rootKey, "w:drawing");
|
2017-03-13 00:02:56 +00:00
|
|
|
console.log(JSON.stringify(newJson, null, 2));
|
2017-03-12 23:32:02 +00:00
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|