added run tests
This commit is contained in:
@ -1,2 +1,3 @@
|
||||
export {Document} from "./document";
|
||||
export {Paragraph} from "./paragraph";
|
||||
export {Run} from "./run"
|
@ -3,6 +3,11 @@
|
||||
import * as docx from "../docx";
|
||||
import {assert} from "chai";
|
||||
|
||||
function jsonify(obj: Object) {
|
||||
var stringifiedJson = JSON.stringify(obj);
|
||||
return JSON.parse(stringifiedJson);
|
||||
}
|
||||
|
||||
describe('Paragraph', () => {
|
||||
var paragraph: docx.Paragraph;
|
||||
|
||||
@ -10,11 +15,6 @@ describe('Paragraph', () => {
|
||||
paragraph = new docx.Paragraph();
|
||||
});
|
||||
|
||||
function jsonify(obj: Object) {
|
||||
var stringifiedJson = JSON.stringify(obj);
|
||||
return JSON.parse(stringifiedJson);
|
||||
}
|
||||
|
||||
describe('#constructor()', () => {
|
||||
|
||||
it("should create valid JSON", () => {
|
||||
|
38
ts/tests/runTest.ts
Normal file
38
ts/tests/runTest.ts
Normal file
@ -0,0 +1,38 @@
|
||||
/// <reference path="../typings/mocha/mocha.d.ts" />
|
||||
/// <reference path="../typings/chai/chai.d.ts" />
|
||||
import {Run} from "../docx/run";
|
||||
import {TextRun} from "../docx//run/text-run"
|
||||
import {assert} from "chai";
|
||||
|
||||
function jsonify(obj: Object) {
|
||||
var stringifiedJson = JSON.stringify(obj);
|
||||
return JSON.parse(stringifiedJson);
|
||||
}
|
||||
|
||||
describe('Run', () => {
|
||||
var run: Run;
|
||||
|
||||
beforeEach(() => {
|
||||
run = new Run();
|
||||
});
|
||||
|
||||
describe('#constructor()', () => {
|
||||
|
||||
it("", () => {
|
||||
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
describe('TextRun', () => {
|
||||
var run: TextRun;
|
||||
|
||||
describe('#constructor()', () => {
|
||||
|
||||
it("should add text into run", () => {
|
||||
run = new TextRun("test");
|
||||
var newJson = jsonify(run);
|
||||
assert(newJson.r[1].t === "test");
|
||||
});
|
||||
});
|
||||
});
|
Reference in New Issue
Block a user