using Markdig;
using MfGames.Markdown.Gemtext.Extensions;
using Xunit;
namespace MfGames.Markdown.Gemtext.Tests.PythonInspired
{
///
/// Runs through various plain input tests.
/// Based on
/// https://github.com/makeworld-the-better-one/md2gemini/blob/master/tests/test_plain.py
///
public class PlainTextPythonTests
{
[Fact]
public void ConvertHtmlBlock()
{
string input = string.Join(
"\n",
"
",
"html is here",
"
",
"",
"Text after");
string expected = string.Join(
"\n",
"```html",
"",
"html is here",
"
",
"```",
"",
"Text after");
string actual = MarkdownGemtext.ToGemtext(
input,
new MarkdownPipelineBuilder()
.Use()
.Build());
Assert.Equal(expected, actual);
}
[Fact]
public void EmptyInput()
{
string input = "";
string expected = "";
string actual = MarkdownGemtext.ToGemtext(input);
Assert.Equal(expected, actual);
}
[Fact]
public void RemoveBold()
{
string input = "Sentence with **bold** in it.";
string expected = "Sentence with bold in it.";
string actual = MarkdownGemtext.ToGemtext(input);
Assert.Equal(expected, actual);
}
[Fact]
public void RemoveBold2()
{
string input = "Sentence with __bold__ in it.";
string expected = "Sentence with bold in it.";
string actual = MarkdownGemtext.ToGemtext(input);
Assert.Equal(expected, actual);
}
[Fact]
public void RemoveInlineHtml()
{
string input =
"test1 test2 test3 test4";
string expected = "test1 test2 test3 test4";
string actual = MarkdownGemtext.ToGemtext(input);
Assert.Equal(expected, actual);
}
[Fact]
public void RemoveItalics()
{
string input = "Sentence with *italics* in it.";
string expected = "Sentence with italics in it.";
string actual = MarkdownGemtext.ToGemtext(input);
Assert.Equal(expected, actual);
}
[Fact]
public void RemoveItalics2()
{
string input = "Sentence with _italics_ in it.";
string expected = "Sentence with italics in it.";
string actual = MarkdownGemtext.ToGemtext(input);
Assert.Equal(expected, actual);
}
}
}