home to your local SPACEGIRL 馃挮
arimelody.space
1package model
2
3import (
4 "testing"
5)
6
7func Test_Link_NormaliseName(t *testing.T) {
8 link := Link{
9 Name: "!c@o#o$l%-^a&w*e(s)o_m=e+-[l{i]n}k-0123456789ABCDEF",
10 }
11
12 want := "cool-awesome-link-0123456789abcdef"
13 got := link.NormaliseName()
14 if want != got {
15 t.Errorf(`name with invalid characters not properly formatted (want "%s", got "%s")`, want, got)
16 }
17
18 link.Name = want
19 got = link.NormaliseName()
20 if want != got {
21 t.Errorf(`valid name mangled by formatter (want "%s", got "%s")`, want, got)
22 }
23}