// @ts-check import os from "node:os"; import path from "node:path"; import test from "ava"; import { characterEntities } from "character-entities"; import { gemoji } from "gemoji"; import helpers from "../helpers/helpers.cjs"; import { lint } from "markdownlint/promise"; import { forEachInlineCodeSpan } from "../lib/markdownit.cjs"; import { getReferenceLinkImageData } from "../lib/cache.mjs"; test("clearHtmlCommentTextValid", (t) => { t.plan(1); const validComments = [ "", "", "", "", " ", " ", "", "", "", "", "", "", "", "", "", "", "", "", "", "texttext", "texttext", "texttext", "", "texttexttext", "texttext", "", "", "", "", " ", " ", "", "", "", "", "", "", "", "", "", "", "", "", "", "texttext", "texttext", "texttext", "", "texttexttext", "texttext", "", "", " -->", "text-->", "text-->", "", "-->", "t-->", "-->", "t-->", "t-->", " " ]; const actual = helpers.clearHtmlCommentText(invalidComments.join("\n")); const expected = invalidComments.join("\n"); t.is(actual, expected); }); test("clearHtmlCommentTextNonGreedy", (t) => { t.plan(1); const nonGreedyComments = [ " -->", " -->", " -->", " -->" ]; const nonGreedyResult = [ " -->", " -->", " -->", " -->" ]; const actual = helpers.clearHtmlCommentText(nonGreedyComments.join("\n")); const expected = nonGreedyResult.join("\n"); t.is(actual, expected); }); test("clearHtmlCommentTextEmbedded", (t) => { t.plan(1); const embeddedComments = [ "texttext", "", "texttext", "texttext", "texttext" ]; const embeddedResult = [ "texttext", "", "texttext", "texttext", "texttext" ]; const actual = helpers.clearHtmlCommentText(embeddedComments.join("\n")); const expected = embeddedResult.join("\n"); t.is(actual, expected); }); test("isBlankLine", (t) => { t.plan(33); // @ts-ignore t.true(helpers.isBlankLine(null), "[null]"); const blankLines = [ "", " ", " ", "\t\t\t", "\r", "\n", "\t\r\n", " ", "", "", "\t", ">", "> ", "> > > \t", "> ", ">>", " ", "-->", "text --> --> text", "text ", "text text", "text --> text --> text