From 96150d005ae3a81ca7b44567732cc11ac4a36420 Mon Sep 17 00:00:00 2001 From: arunkumar Date: Thu, 28 Jan 2021 16:33:55 +0530 Subject: [PATCH] changes in compileText for links representation --- lib/compileText.js | 2 +- test/compileText.test.js | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/compileText.js b/lib/compileText.js index 33e5cf3..dd72353 100644 --- a/lib/compileText.js +++ b/lib/compileText.js @@ -8,7 +8,7 @@ function CompileText(ast) { let result = ""; if (element.type === "url") { result = mapper(element.children); - str += mapper(element.children) + " " + element.url; + str += mapper(element.children) + " (" + element.url + ")"; } else { result = mapper(element.children); str = str + result; diff --git a/test/compileText.test.js b/test/compileText.test.js index 00c1924..f89c26f 100644 --- a/test/compileText.test.js +++ b/test/compileText.test.js @@ -16,7 +16,7 @@ describe("Compile AST to Raw String", function () { const ast = [ { type: "url", children: ["The Feathers"], url: "feathers.studio" }, ]; - expect(CompileText(ast)).to.eql("The Feathers feathers.studio"); + expect(CompileText(ast)).to.eql("The Feathers (feathers.studio)"); }); it("Formatted Link AST", function () { @@ -32,7 +32,7 @@ describe("Compile AST to Raw String", function () { url: "feathers.studio", }, ]; - expect(CompileText(ast)).to.eql("The Feathers feathers.studio"); + expect(CompileText(ast)).to.eql("The Feathers (feathers.studio)"); }); // it("Wrongly Formatted Link AST", function () {