added run tests

This commit is contained in:
Dolan Miu
2016-03-30 03:58:53 +01:00
parent a0acb6d1a6
commit b81c3875a3
3 changed files with 44 additions and 5 deletions

View File

@ -1,2 +1,3 @@
export {Document} from "./document"; export {Document} from "./document";
export {Paragraph} from "./paragraph"; export {Paragraph} from "./paragraph";
export {Run} from "./run"

View File

@ -3,6 +3,11 @@
import * as docx from "../docx"; import * as docx from "../docx";
import {assert} from "chai"; import {assert} from "chai";
function jsonify(obj: Object) {
var stringifiedJson = JSON.stringify(obj);
return JSON.parse(stringifiedJson);
}
describe('Paragraph', () => { describe('Paragraph', () => {
var paragraph: docx.Paragraph; var paragraph: docx.Paragraph;
@ -10,11 +15,6 @@ describe('Paragraph', () => {
paragraph = new docx.Paragraph(); paragraph = new docx.Paragraph();
}); });
function jsonify(obj: Object) {
var stringifiedJson = JSON.stringify(obj);
return JSON.parse(stringifiedJson);
}
describe('#constructor()', () => { describe('#constructor()', () => {
it("should create valid JSON", () => { it("should create valid JSON", () => {

38
ts/tests/runTest.ts Normal file
View 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");
});
});
});