2018-09-20 10:11:59 -03:00
|
|
|
import { expect } from "chai";
|
2018-10-26 01:04:07 +01:00
|
|
|
|
|
|
|
import { Formatter } from "export/formatter";
|
|
|
|
|
|
|
|
import { UpdateFields } from "./update-fields";
|
|
|
|
|
2018-09-20 10:11:59 -03:00
|
|
|
const UF_TRUE = {
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:updateFields": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": true,
|
2018-09-20 10:11:59 -03:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-09-20 10:11:59 -03:00
|
|
|
};
|
|
|
|
const UF_FALSE = {
|
2019-04-09 05:27:18 -04:00
|
|
|
"w:updateFields": {
|
|
|
|
_attr: {
|
|
|
|
"w:val": false,
|
2018-09-20 10:11:59 -03:00
|
|
|
},
|
2019-04-09 05:27:18 -04:00
|
|
|
},
|
2018-09-20 10:11:59 -03:00
|
|
|
};
|
|
|
|
describe("Update Fields", () => {
|
|
|
|
describe("#constructor", () => {
|
|
|
|
it("should construct a Update Fields with TRUE value by default", () => {
|
|
|
|
const uf = new UpdateFields();
|
|
|
|
const tree = new Formatter().format(uf);
|
|
|
|
expect(tree).to.be.deep.equal(UF_TRUE);
|
|
|
|
});
|
|
|
|
it("should construct a Update Fields with TRUE value", () => {
|
|
|
|
const uf = new UpdateFields(true);
|
|
|
|
const tree = new Formatter().format(uf);
|
|
|
|
expect(tree).to.be.deep.equal(UF_TRUE);
|
|
|
|
});
|
|
|
|
it("should construct a Update Fields with FALSE value", () => {
|
|
|
|
const uf = new UpdateFields(false);
|
|
|
|
const tree = new Formatter().format(uf);
|
|
|
|
expect(tree).to.be.deep.equal(UF_FALSE);
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|