status-go/server/device_test.go
2022-11-25 11:33:58 +00:00

46 lines
715 B
Go

package server
import (
"testing"
"github.com/stretchr/testify/require"
)
var (
testCaseInput = []string{
"some-computer-name.local",
"Hello.local",
"I'm an input.locally",
"some-plain-input",
"smol",
}
)
func TestRemoveSuffix(t *testing.T) {
tce := []string{
"some-computer-name",
"Hello",
"I'm an input.locally",
"some-plain-input",
"smol",
}
for i, tci := range testCaseInput {
require.Equal(t, tce[i], RemoveSuffix(tci, local))
}
}
func TestParseHostname(t *testing.T) {
tce := []string{
"some computer name",
"Hello",
"I'm an input.locally",
"some plain input",
"smol",
}
for i, tci := range testCaseInput {
require.Equal(t, tce[i], parseHostname(tci))
}
}