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

Function TestSlugifyTruncatesLongNames

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

Source from the content-addressed store, hash-verified

25}
26
27func TestSlugifyTruncatesLongNames(t *testing.T) {
28 cases := []struct {
29 in, want string
30 }{
31 // Exactly 6 words — no truncation.
32 {"clarify caas exit plan scope today", "clarify-caas-exit-plan-scope-today"},
33 // 7 words — truncated to 6.
34 {"clarify caas exit plan scope with jayant", "clarify-caas-exit-plan-scope-with"},
35 // 10 words.
36 {"one two three four five six seven eight nine ten", "one-two-three-four-five-six"},
37 }
38 for _, c := range cases {
39 got, err := Slugify(c.in)
40 if err != nil {
41 t.Errorf("Slugify(%q) returned error: %v", c.in, err)
42 continue
43 }
44 if got != c.want {
45 t.Errorf("Slugify(%q) = %q, want %q", c.in, got, c.want)
46 }
47 }
48}
49
50func TestSlugifyEmpty(t *testing.T) {
51 if _, err := Slugify(""); err == nil {

Callers

nothing calls this directly

Calls 1

SlugifyFunction · 0.85

Tested by

no test coverage detected