mirror of
https://github.com/usememos/memos.git
synced 2025-06-05 22:09:59 +02:00
chore: implement part of nodes
This commit is contained in:
@ -5,17 +5,18 @@ import (
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/usememos/memos/plugin/gomark/ast"
|
||||
"github.com/usememos/memos/plugin/gomark/parser/tokenizer"
|
||||
)
|
||||
|
||||
func TestImageParser(t *testing.T) {
|
||||
tests := []struct {
|
||||
text string
|
||||
image *ImageParser
|
||||
image ast.Node
|
||||
}{
|
||||
{
|
||||
text: "",
|
||||
image: &ImageParser{
|
||||
image: &ast.Image{
|
||||
AltText: "",
|
||||
URL: "https://example.com",
|
||||
},
|
||||
@ -30,7 +31,7 @@ func TestImageParser(t *testing.T) {
|
||||
},
|
||||
{
|
||||
text: "",
|
||||
image: &ImageParser{
|
||||
image: &ast.Image{
|
||||
AltText: "al te",
|
||||
URL: "https://example.com",
|
||||
},
|
||||
@ -38,6 +39,6 @@ func TestImageParser(t *testing.T) {
|
||||
}
|
||||
for _, test := range tests {
|
||||
tokens := tokenizer.Tokenize(test.text)
|
||||
require.Equal(t, test.image, NewImageParser().Match(tokens))
|
||||
require.Equal(t, test.image, NewImageParser().Parse(tokens))
|
||||
}
|
||||
}
|
||||
|
Reference in New Issue
Block a user