changeloguru/pkg/markdown/generate_test.go

40 lines
563 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",
},
},
want: "# header\n\n- item 1\n\n- item 2",
2020-11-27 11:02:33 +00:00
},
}
for _, tc := range tests {
t.Run(tc.name, func(t *testing.T) {
got := Generate(tc.bases)
assert.Equal(t, tc.want, got)
})
}
}