mirror of
https://github.com/signaller-matrix/signaller.git
synced 2024-11-26 04:12:19 +00:00
35 lines
677 B
Go
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)
|
||
|
}
|
||
|
|
||
|
}
|