*: Reorganize code

This commit is contained in:
Manuel Rüger
2024-09-26 15:24:39 +02:00
parent 2c71b50438
commit dc8842106b
74 changed files with 114 additions and 73 deletions

30
metadata/metadata_test.go Normal file
View File

@@ -0,0 +1,30 @@
package metadata
import (
"os"
"path"
"runtime"
"testing"
"github.com/stretchr/testify/assert"
)
func TestExtractDocumentLeadingH1(t *testing.T) {
_, filename, _, _ := runtime.Caller(0)
dir := path.Join(path.Dir(filename), "..")
err := os.Chdir(dir)
if err != nil {
panic(err)
}
filename = "testdata/header.md"
markdown, err := os.ReadFile(filename)
if err != nil {
panic(err)
}
actual := ExtractDocumentLeadingH1(markdown)
assert.Equal(t, "a", actual)
}