changeloguru/internal/markdown/generate_test.go

40 lines
569 B
Go
Raw Normal View History

2020-11-27 11:02:33 +00:00
package markdown
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGenerate(t *testing.T) {
tests := []struct {
name string
bases []Node
2020-11-27 11:02:33 +00:00
want string
}{
{
name: "normal",
bases: []Node{
2020-11-27 11:02:33 +00:00
header{
level: 1,
text: "header",
},
listItem{
text: "item 1",
},
listItem{
text: "item 2",
},
},
2021-01-11 18:37:11 +00:00
want: "# header\n\n- item 1\n\n- item 2\n",
2020-11-27 11:02:33 +00:00
},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
got := GenerateText(tc.bases)
2020-11-27 11:02:33 +00:00
assert.Equal(t, tc.want, got)
})
}
}