fix installer

This commit is contained in:
Daniel Noulet 2026-10-02 21:45:42 +02:00
parent 46030a5b14
commit c2091e746a
19 changed files with 264 additions and 73 deletions

View file

@ -0,0 +1,29 @@
package server
import (
"testing"
"github.com/danyel/go-loose/internal/config"
)
func TestRequestTenantSlug(t *testing.T) {
server := &Server{cfg: config.Config{AuthDomain: "auth.dev"}}
tests := []struct {
host string
want string
}{
{host: "auth.dev", want: ""},
{host: "auth.dev:8080", want: ""},
{host: "nmbs.auth.dev", want: "nmbs"},
{host: "NMBS.auth.dev:8080", want: "nmbs"},
{host: "nested.nmbs.auth.dev", want: ""},
{host: "localhost:8080", want: ""},
}
for _, test := range tests {
t.Run(test.host, func(t *testing.T) {
if got := server.requestTenantSlug(test.host); got != test.want {
t.Fatalf("requestTenantSlug(%q) = %q, want %q", test.host, got, test.want)
}
})
}
}