diff --git a/src/patcher/content-types-manager.spec.ts b/src/patcher/content-types-manager.spec.ts
new file mode 100644
index 0000000000..0dd8eb38c4
--- /dev/null
+++ b/src/patcher/content-types-manager.spec.ts
@@ -0,0 +1,51 @@
+import { expect } from "chai";
+import { appendContentType } from "./content-types-manager";
+
+describe("content-types-manager", () => {
+ describe("appendContentType", () => {
+ it("should append a content type", () => {
+ const element = {
+ type: "element",
+ name: "xml",
+ elements: [
+ {
+ type: "element",
+ name: "Types",
+ elements: [
+ {
+ type: "element",
+ name: "Default",
+ },
+ ],
+ },
+ ],
+ };
+ appendContentType(element, "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml", "docx");
+
+ expect(element).to.deep.equal({
+ elements: [
+ {
+ elements: [
+ {
+ name: "Default",
+ type: "element",
+ },
+ {
+ attributes: {
+ ContentType: "application/vnd.openxmlformats-officedocument.wordprocessingml.document.main+xml",
+ Extension: "docx",
+ },
+ name: "Default",
+ type: "element",
+ },
+ ],
+ name: "Types",
+ type: "element",
+ },
+ ],
+ name: "xml",
+ type: "element",
+ });
+ });
+ });
+});
diff --git a/src/patcher/util.spec.ts b/src/patcher/util.spec.ts
new file mode 100644
index 0000000000..6482298754
--- /dev/null
+++ b/src/patcher/util.spec.ts
@@ -0,0 +1,46 @@
+import { expect } from "chai";
+
+import { createTextElementContents, getFirstLevelElements, patchSpaceAttribute, toJson } from "./util";
+
+describe("util", () => {
+ describe("toJson", () => {
+ it("should return an Element", () => {
+ const output = toJson("");
+ expect(output).to.be.an("object");
+ });
+ });
+
+ describe("createTextElementContents", () => {
+ it("should return an array of elements", () => {
+ const output = createTextElementContents("hello");
+ expect(output).to.deep.equal([{ type: "text", text: "hello" }]);
+ });
+ });
+
+ describe("patchSpaceAttribute", () => {
+ it("should return an element with the xml:space attribute", () => {
+ const output = patchSpaceAttribute({ type: "element", name: "xml" });
+ expect(output).to.deep.equal({
+ type: "element",
+ name: "xml",
+ attributes: {
+ "xml:space": "preserve",
+ },
+ });
+ });
+ });
+
+ describe("getFirstLevelElements", () => {
+ it("should return an empty array if no elements are found", () => {
+ const output = toJson("");
+ const elements = getFirstLevelElements(output, "Relationships");
+ expect(elements).to.deep.equal([]);
+ });
+
+ it("should return an array if elements are found", () => {
+ const output = toJson("");
+ const elements = getFirstLevelElements(output, "Relationships");
+ expect(elements).to.deep.equal([{ type: "element", name: "Relationship" }]);
+ });
+ });
+});