This repository has been archived by the owner on Oct 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b886ce1
commit 9d7e4a1
Showing
4 changed files
with
104 additions
and
0 deletions.
There are no files selected for viewing
24 changes: 24 additions & 0 deletions
24
tests/Fornax.Nfdi4Plants.Tests/Fornax.Nfdi4Plants.Tests.fsproj
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<Project Sdk="Microsoft.NET.Sdk"> | ||
|
||
<PropertyGroup> | ||
<OutputType>Exe</OutputType> | ||
<TargetFramework>net5.0</TargetFramework> | ||
<GenerateProgramFile>false</GenerateProgramFile> | ||
</PropertyGroup> | ||
|
||
<ItemGroup> | ||
<Compile Include="nfdi-header.tests.fs" /> | ||
<Compile Include="nfdi-sidebar-element-header.tests.fs" /> | ||
<Compile Include="main.fs" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<PackageReference Include="Expecto" Version="9.*" /> | ||
<PackageReference Include="YoloDev.Expecto.TestSdk" Version="0.*" /> | ||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.*" /> | ||
</ItemGroup> | ||
|
||
<ItemGroup> | ||
<ProjectReference Include="..\..\src\Fornax.Nfdi4Plants\Fornax.Nfdi4Plants.fsproj" /> | ||
</ItemGroup> | ||
</Project> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
module Fornax.Nfdi4Plants.Tests | ||
|
||
open Expecto | ||
|
||
open Tests.MarkdigExtensions | ||
|
||
let allTests = testList "" [ | ||
Nfdi4PlantsSidebarHeader.tests | ||
Nfdi4PlantsHeader.tests | ||
] | ||
|
||
[<EntryPoint>] | ||
let main argv = | ||
runTestsWithCLIArgs [] [||] allTests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
module Tests.MarkdigExtensions.Nfdi4PlantsHeader | ||
|
||
open Expecto | ||
open Fornax.Nfdi4Plants | ||
open Fornax.Nfdi4Plants.MarkdigExtensions.NfdiHeader | ||
open Markdig | ||
|
||
let pipeline = | ||
let builder = new MarkdownPipelineBuilder() | ||
builder | ||
.UseAdvancedExtensions() | ||
.UseEmojiAndSmiley() | ||
.UseNFDIHeader() | ||
.Build() | ||
|
||
[<Tests>] | ||
let tests = | ||
testList "UseNFDIHeader" [ | ||
test "basic case" { | ||
let markdown = """# Start testing!""" | ||
let result = Markdown.ToHtml(markdown, pipeline) | ||
Expect.equal result $"""<nfdi-h1 id="start-testing">Start testing!</nfdi-h1>{'\010'}""" "" | ||
} | ||
test "5 depth case" { | ||
let markdown = """##### Start testing!""" | ||
let result = Markdown.ToHtml(markdown, pipeline) | ||
Expect.equal result $"""<nfdi-h5 id="start-testing">Start testing!</nfdi-h5>{'\010'}""" "" | ||
} | ||
test "6 depth case" { | ||
let markdown = """###### Start testing!""" | ||
let result = Markdown.ToHtml(markdown, pipeline) | ||
Expect.equal result $"""<nfdi-h6 id="start-testing">Start testing!</nfdi-h6>{'\010'}""" "" | ||
} | ||
] |
32 changes: 32 additions & 0 deletions
32
tests/Fornax.Nfdi4Plants.Tests/nfdi-sidebar-element-header.tests.fs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
module Tests.MarkdigExtensions.Nfdi4PlantsSidebarHeader | ||
|
||
open Expecto | ||
open Fornax.Nfdi4Plants | ||
open Fornax.Nfdi4Plants.MarkdigExtensions.NfdiSidebarElementHeader | ||
open Markdig | ||
|
||
let pipeline = | ||
let builder = new MarkdownPipelineBuilder() | ||
builder | ||
.UseSidebarHeader() | ||
.Build() | ||
|
||
[<Tests>] | ||
let tests = | ||
testList "UseSidebarHeader" [ | ||
test "basic case" { | ||
let markdown = """# Start testing!:#start-testing""" | ||
let result = Markdown.ToHtml(markdown, pipeline) | ||
Expect.equal result $"""<h1 slot="inner" href="#start-testing">Start testing!</h1>{'\010'}""" "" | ||
} | ||
test "base case without link" { | ||
let markdown = """# Start testing!""" | ||
let result = Markdown.ToHtml(markdown, pipeline) | ||
Expect.equal result $"""<h1 slot="inner">Start testing!</h1>{'\010'}""" "" | ||
} | ||
test "6 depth case" { | ||
let markdown = """###### Start testing!""" | ||
let result = Markdown.ToHtml(markdown, pipeline) | ||
Expect.equal result $"""<h3 slot="inner">Start testing!</h3>{'\010'}""" "" | ||
} | ||
] |