Files
docx-js/src/file/footer-wrapper.spec.ts

68 lines
2.1 KiB
TypeScript
Raw Normal View History

import { expect } from "chai";
import * as sinon from "sinon";
import { FooterWrapper } from "./footer-wrapper";
import { Media } from "./media";
import { Paragraph } from "./paragraph";
import { Table } from "./table";
describe("FooterWrapper", () => {
describe("#addParagraph", () => {
it("should call the underlying footer's addParagraph", () => {
const file = new FooterWrapper(new Media(), 1);
const spy = sinon.spy(file.Footer, "addParagraph");
2019-06-12 01:03:36 +01:00
file.addParagraph(new Paragraph({}));
expect(spy.called).to.equal(true);
});
});
describe("#addTable", () => {
it("should call the underlying footer's addParagraph", () => {
const file = new FooterWrapper(new Media(), 1);
const spy = sinon.spy(file.Footer, "addTable");
2019-03-13 02:29:11 +00:00
file.addTable(
new Table({
rows: 1,
columns: 1,
}),
);
expect(spy.called).to.equal(true);
});
});
2019-01-03 02:36:56 +00:00
describe("#addImage", () => {
it("should call the underlying footer's addImage", () => {
const file = new FooterWrapper(new Media(), 1);
const spy = sinon.spy(file.Footer, "addParagraph");
// tslint:disable-next-line:no-any
file.addImage({} as any);
expect(spy.called).to.equal(true);
});
});
describe("#createImage", () => {
it("should call the underlying footer's createImage", () => {
const file = new FooterWrapper(new Media(), 1);
2019-06-25 01:21:28 +01:00
const spy = sinon.spy(Media, "addImage");
2019-01-03 02:36:56 +00:00
file.createImage("");
expect(spy.called).to.equal(true);
2019-06-25 01:21:28 +01:00
spy.restore();
2019-01-03 02:36:56 +00:00
});
});
describe("#addChildElement", () => {
it("should call the underlying footer's addChildElement", () => {
const file = new FooterWrapper(new Media(), 1);
const spy = sinon.spy(file.Footer, "addChildElement");
// tslint:disable-next-line:no-any
file.addChildElement({} as any);
expect(spy.called).to.equal(true);
});
});
});