markdown_service_test.go 526 B

123456789101112131415161718192021222324252627282930
  1. package v2
  2. import (
  3. "testing"
  4. "github.com/stretchr/testify/require"
  5. "github.com/usememos/memos/plugin/gomark/ast"
  6. apiv2pb "github.com/usememos/memos/proto/gen/api/v2"
  7. )
  8. func TestConvertFromASTNodes(t *testing.T) {
  9. tests := []struct {
  10. name string
  11. rawNodes []ast.Node
  12. want []*apiv2pb.Node
  13. }{
  14. {
  15. name: "empty",
  16. want: []*apiv2pb.Node{},
  17. },
  18. }
  19. for _, tt := range tests {
  20. t.Run(tt.name, func(t *testing.T) {
  21. got := convertFromASTNodes(tt.rawNodes)
  22. require.Equal(t, tt.want, got)
  23. })
  24. }
  25. }