This commit is contained in:
parent
08981319e1
commit
cdcca4cff6
2 changed files with 39 additions and 2 deletions
|
@ -1,11 +1,10 @@
|
||||||
---
|
---
|
||||||
name: "Testing"
|
name: "Testing"
|
||||||
description: "Performs unit and lint tests for Enbas with mage"
|
description: "Performs tests for Enbas with mage"
|
||||||
runs:
|
runs:
|
||||||
using: "docker"
|
using: "docker"
|
||||||
image: "Dockerfile"
|
image: "Dockerfile"
|
||||||
env:
|
env:
|
||||||
ENBAS_TEST_VERBOSE: "1"
|
ENBAS_TEST_VERBOSE: "1"
|
||||||
ENBAS_TEST_COVER: "1"
|
ENBAS_TEST_COVER: "1"
|
||||||
pre-entrypoint: "go version"
|
|
||||||
entrypoint: "mage -v test"
|
entrypoint: "mage -v test"
|
||||||
|
|
38
internal/utilities/utilities_test.go
Normal file
38
internal/utilities/utilities_test.go
Normal file
|
@ -0,0 +1,38 @@
|
||||||
|
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)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue