<commit_before>/// <reference path="../../typings/mocha/mocha.d.ts" />
/// <reference path="../../typings/lodash/lodash.d.ts" />
/// <reference path="../../typings/chai/chai.d.ts" />

import {Formatter} from "../../export/Formatter";
import * as docx from "../../docx";
import {Attributes} from "../../docx/xml-components";
import {Properties} from "../../properties";
import {assert} from "chai";

function jsonify(obj: Object) {
    let stringifiedJson = JSON.stringify(obj);
    return JSON.parse(stringifiedJson);
}

describe("Formatter", () => {
    let formatter: Formatter;

    beforeEach(() => {
        formatter = new Formatter();
    });

    describe("#format()", () => {
        it("should format simple paragraph", () => {
            let paragraph = new docx.Paragraph();
            let newJson = formatter.format(paragraph);
            newJson = jsonify(newJson);
            assert.isDefined(newJson["w:p"]);
        });

        it("should remove xmlKeys", () => {
            let paragraph = new docx.Paragraph();
            let newJson = formatter.format(paragraph);
            let stringifiedJson = JSON.stringify(newJson);
            assert(stringifiedJson.indexOf("xmlKeys") < 0);
        });<commit_msg>fix capitalization typo in tests. closes #2<commit_after>/// <reference path="../../typings/mocha/mocha.d.ts" />
/// <reference path="../../typings/lodash/lodash.d.ts" />
/// <reference path="../../typings/chai/chai.d.ts" />

import {Formatter} from "../../export/formatter";
import * as docx from "../../docx";
import {Attributes} from "../../docx/xml-components";
import {Properties} from "../../properties";
import {assert} from "chai";

function jsonify(obj: Object) {
    let stringifiedJson = JSON.stringify(obj);
    return JSON.parse(stringifiedJson);
}

describe("Formatter", () => {
    let formatter: Formatter;

    beforeEach(() => {
        formatter = new Formatter();
    });

    describe("#format()", () => {
        it("should format simple paragraph", () => {
            let paragraph = new docx.Paragraph();
            let newJson = formatter.format(paragraph);
            newJson = jsonify(newJson);
            assert.isDefined(newJson["w:p"]);
        });

        it("should remove xmlKeys", () => {
            let paragraph = new docx.Paragraph();
            let newJson = formatter.format(paragraph);
            let stringifiedJson = JSON.stringify(newJson);
            assert(stringifiedJson.indexOf("xmlKeys") < 0);
        });
{'fraction_non_alphanumeric': 0.18669871794871795, 'fraction_numerical': 0.001201923076923077, 'mean_word_length': 2.516901408450704, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 6}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4917137', 'n_tokens_mistral': 719, 'n_tokens_neox': 704, 'n_words': 154}