model function unit tests!
This commit is contained in:
parent
e5ae167550
commit
6db35b2f99
9 changed files with 254 additions and 16 deletions
23
model/link_test.go
Normal file
23
model/link_test.go
Normal file
|
@ -0,0 +1,23 @@
|
|||
package model
|
||||
|
||||
import (
|
||||
"testing"
|
||||
)
|
||||
|
||||
func Test_Link_NormaliseName(t *testing.T) {
|
||||
link := Link{
|
||||
Name: "!c@o#o$l%-^a&w*e(s)o_m=e+-[l{i]n}k-0123456789ABCDEF",
|
||||
}
|
||||
|
||||
want := "cool-awesome-link-0123456789abcdef"
|
||||
got := link.NormaliseName()
|
||||
if want != got {
|
||||
t.Errorf(`name with invalid characters not properly formatted (want "%s", got "%s")`, want, got)
|
||||
}
|
||||
|
||||
link.Name = want
|
||||
got = link.NormaliseName()
|
||||
if want != got {
|
||||
t.Errorf(`valid name mangled by formatter (want "%s", got "%s")`, want, got)
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue