signaller/internal/utils_test.go
2019-08-08 19:38:30 +05:00

35 lines
677 B
Go

package internal
import (
"testing"
"github.com/stretchr/testify/assert"
)
func TestGetCanonicalAlias(t *testing.T) {
tests := []struct {
hostname string
alias string
expected string
}{{"host.com", "alias", "#alias:host.com"}}
for _, test := range tests {
got := GetCanonicalAlias(test.hostname, test.alias)
assert.Equal(t, test.expected, got)
}
}
func TestStripAlias(t *testing.T) {
tests := []struct {
hostname string
canonicalAlias string
expected string
}{{"host.com", "#alias:host.com", "alias"}}
for _, test := range tests {
got := StripAlias(test.hostname, test.canonicalAlias)
assert.Equal(t, test.expected, got)
}
}