27 lines
485 B
Go
27 lines
485 B
Go
package models_test
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
"lmika.dev/lmika/weiro/models"
|
|
)
|
|
|
|
func TestGeneratePageSlug(t *testing.T) {
|
|
tests := []struct {
|
|
title string
|
|
want string
|
|
}{
|
|
{"About Me", "about-me"},
|
|
{" Contact Us ", "contact-us"},
|
|
{"Hello---World", "hello-world"},
|
|
{"FAQ", "faq"},
|
|
{"", ""},
|
|
}
|
|
for _, tt := range tests {
|
|
t.Run(tt.title, func(t *testing.T) {
|
|
assert.Equal(t, tt.want, models.GeneratePageSlug(tt.title))
|
|
})
|
|
}
|
|
}
|