21 lines
734 B
Go
21 lines
734 B
Go
package store
|
|||
|
|
|
||
|
|
import "testing"
|
||
|
|
|
||
|
|
// The exemption is the safety of the whole rule: a build predating device naming calls
|
||
|
|
// itself "Memby TV", and a household with two of those would otherwise watch each set
|
||
|
|
// sign the other out every time somebody opened the app.
|
||
|
|
func TestSupersedeNameRefusesNamesThatIdentifyNothing(t *testing.T) {
|
||
|
|
for _, name := range []string{"", " ", DefaultDeviceName, "memby tv", " Memby TV "} {
|
||
|
|
if got := supersedeName(name); got != "" {
|
||
|
|
t.Fatalf("supersedeName(%q) = %q, want no match", name, got)
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
func TestSupersedeNameMatchesOnTheNameSomebodyTyped(t *testing.T) {
|
||
|
|
if got := supersedeName(" Living room "); got != "Living room" {
|
||
|
|
t.Fatalf("supersedeName trimmed to %q", got)
|
||
|
|
}
|
||
|
|
}
|