diff --git a/test/compileHTML.test.js b/test/compileHTML.test.js
new file mode 100644
index 0000000..903b626
--- /dev/null
+++ b/test/compileHTML.test.js
@@ -0,0 +1,14 @@
+const expect = require("chai").expect;
+const CompileText = require("../lib/compileText");
+
+// describe("Compile AST to HTML String", function () {
+// it("Simple AST", function () {
+// const ast = [
+// { type: 'bold', children: [ 'arun' ] },
+// { type: 'text', children: [ 'bold' ] },
+// { type: 'text', children: [ 'son' ] }
+// ];
+// const expectedOutput =
+// expect(CompileText(ast)).to.eql("TheKINGMaker");
+// });
+// });
diff --git a/test/compileText.test.js b/test/compileText.test.js
new file mode 100644
index 0000000..00c1924
--- /dev/null
+++ b/test/compileText.test.js
@@ -0,0 +1,74 @@
+const expect = require("chai").expect;
+const CompileText = require("../lib/compileText");
+
+describe("Compile AST to Raw String", function () {
+ it("Simple AST", function () {
+ const ast = [
+ {
+ type: "underline",
+ children: ["The", { type: "bold", children: ["KING"] }, "Maker"],
+ },
+ ];
+ expect(CompileText(ast)).to.eql("TheKINGMaker");
+ });
+
+ it("Link AST", function () {
+ const ast = [
+ { type: "url", children: ["The Feathers"], url: "feathers.studio" },
+ ];
+ expect(CompileText(ast)).to.eql("The Feathers feathers.studio");
+ });
+
+ it("Formatted Link AST", function () {
+ const ast = [
+ {
+ type: "url",
+ children: [
+ {
+ type: "bold",
+ children: ["The ", { type: "underline", children: ["Feathers"] }],
+ },
+ ],
+ url: "feathers.studio",
+ },
+ ];
+ expect(CompileText(ast)).to.eql("The Feathers feathers.studio");
+ });
+
+ // it("Wrongly Formatted Link AST", function () {
+ // const ast = [
+ // { type: "bold", children: ["[The ==Feathers==](feathers.studio)"] },
+ // ];
+ // expect(CompileText(ast)).to.eql("[The ==Feathers==](feathers.studio)");
+ // });
+
+ it("Nested AST", function () {
+ const ast = [
+ {
+ type: "bold",
+ children: [
+ "Bold",
+ {
+ type: "italics",
+ children: [
+ "Italics",
+ {
+ type: "strikethrough",
+ children: [
+ "strikethrough",
+ { type: "underline", children: ["underline"] },
+ "strikethrough",
+ ],
+ },
+ "Italics",
+ ],
+ },
+ "Bold",
+ ],
+ },
+ ];
+ expect(CompileText(ast)).to.equal(
+ "BoldItalicsstrikethroughunderlinestrikethroughItalicsBold",
+ );
+ });
+});
diff --git a/test/index.test.js b/test/index.test.js
index 9ef39b7..840607e 100644
--- a/test/index.test.js
+++ b/test/index.test.js
@@ -56,19 +56,16 @@ describe("Parser Checks", function () {
]);
});
- it("Bold text inside the Bold text", function () {
- expect(Parse("**Outer**InnerBold**Bold**")).to.eql([
- { type: "bold", children: ["Outer"] },
- { type: "text", children: ["InnerBold"] },
- { type: "bold", children: ["Bold"] },
- ]);
- });
-
it("Nested Check 1", function () {
expect(
Parse(
"**Bold_Italics~~strikethrough==underline==strikethrough~~Italics_Bold**",
- ),
+ ),[
+ {
+ type: 'underline',
+ children: [ 'The', { type: 'bold', children: [ 'KING' ] }, 'Maker' ]
+ }
+ ]
).to.eql([
{
type: "bold",
@@ -94,6 +91,4 @@ describe("Parser Checks", function () {
},
]);
});
-
- it("");
});