enbas/internal/utilities/utilities_test.go
Dan Anglin 7fd93e8778
Some checks failed
Tests / test (pull_request) Successful in 15s
REUSE Compliance Check / check (push) Failing after 13s
ci: add a workflow for tests
- Added an action for running mage targets
- Added a workflow for running tests
- Add our first unit test

PR: #52
2024-08-17 19:15:12 +01:00

38 lines
725 B
Go

package utilities_test
import (
"testing"
"codeflow.dananglin.me.uk/apollo/enbas/internal/utilities"
)
func TestGetFQDN(t *testing.T) {
t.Parallel()
cases := []struct {
instance string
want string
}{
{
instance: "https://gts.red-crow.private",
want: "gts.red-crow.private",
},
{
instance: "http://gotosocial.yellow-desert.social",
want: "gotosocial.yellow-desert.social",
},
{
instance: "fedi.blue-mammoth.party",
want: "fedi.blue-mammoth.party",
},
}
for _, c := range cases {
got := utilities.GetFQDN(c.instance)
if c.want != got {
t.Errorf("Unexpected result: want %s, got %s", c.want, got)
} else {
t.Logf("Expected result: got %s", got)
}
}
}