30 lines
644 B
Go
30 lines
644 B
Go
// ingestion/internal/wiki/slug_test.go
|
|
package wiki
|
|
|
|
import (
|
|
"testing"
|
|
|
|
"github.com/stretchr/testify/assert"
|
|
)
|
|
|
|
func TestSlug(t *testing.T) {
|
|
tests := []struct {
|
|
input string
|
|
want string
|
|
}{
|
|
{"Domain Driven Design", "domain-driven-design"},
|
|
{"It's Complicated", "its-complicated"},
|
|
{"gRPC", "grpc"},
|
|
{"GPT-4o", "gpt-4o"},
|
|
{"Property 1: It's Rough", "property-1-its-rough"},
|
|
{" leading spaces ", "leading-spaces"},
|
|
{"multiple spaces", "multiple-spaces"},
|
|
{"already-kebab", "already-kebab"},
|
|
}
|
|
for _, tc := range tests {
|
|
t.Run(tc.input, func(t *testing.T) {
|
|
assert.Equal(t, tc.want, Slug(tc.input))
|
|
})
|
|
}
|
|
}
|