MCPcopy Create free account
hub / github.com/Facets-cloud/flow / TestSlugify

Function TestSlugify

internal/app/slug_test.go:5–25  ·  view source on GitHub ↗
(t *testing.T)

Source from the content-addressed store, hash-verified

3import "testing"
4
5func TestSlugify(t *testing.T) {
6 cases := []struct {
7 in, want string
8 }{
9 {"hello world", "hello-world"},
10 {"Add Auth To Budgeting App", "add-auth-to-budgeting-app"},
11 {"Fix bug in login.py!", "fix-bug-in-login-py"},
12 {" too many spaces ", "too-many-spaces"},
13 {"--leading and trailing--", "leading-and-trailing"},
14 }
15 for _, c := range cases {
16 got, err := Slugify(c.in)
17 if err != nil {
18 t.Errorf("Slugify(%q) returned error: %v", c.in, err)
19 continue
20 }
21 if got != c.want {
22 t.Errorf("Slugify(%q) = %q, want %q", c.in, got, c.want)
23 }
24 }
25}
26
27func TestSlugifyTruncatesLongNames(t *testing.T) {
28 cases := []struct {

Callers

nothing calls this directly

Calls 1

SlugifyFunction · 0.85

Tested by

no test coverage detected