2024-01-11 21:10:32 +00:00
|
|
|
package dns
|
2024-01-11 19:37:56 +00:00
|
|
|
|
|
|
|
import "testing"
|
|
|
|
|
|
|
|
func TestExtractUsernameSimple(t *testing.T) {
|
2024-01-11 21:10:32 +00:00
|
|
|
username := ExtractUsername(
|
2024-01-11 19:37:56 +00:00
|
|
|
"pages.local",
|
|
|
|
"papatutuwawa.pages.local",
|
|
|
|
)
|
|
|
|
if username != "papatutuwawa" {
|
|
|
|
t.Fatalf("Unexpected username: '%s'", username)
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
func TestExtractUsernameDot(t *testing.T) {
|
2024-01-11 21:10:32 +00:00
|
|
|
username := ExtractUsername(
|
2024-01-11 19:37:56 +00:00
|
|
|
"pages.local",
|
|
|
|
"polynom.me.pages.local",
|
|
|
|
)
|
|
|
|
if username != "polynom.me" {
|
|
|
|
t.Fatalf("Unexpected username: '%s'", username)
|
|
|
|
}
|
|
|
|
}
|