up
This commit is contained in:
@@ -19,7 +19,35 @@ func TestGetAppURLLocalhostAddsPort(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestAbsAppURLRelativePath(t *testing.T) {
|
||||
func TestGetPublicURLPrefersPublicURL(t *testing.T) {
|
||||
app.Http = &config.AppConfig{
|
||||
Server: config.ServerConfig{
|
||||
Url: "http://localhost:8080",
|
||||
PublicUrl: "admin.u-site.app",
|
||||
Port: "8080",
|
||||
},
|
||||
}
|
||||
if got := getPublicURL(); got != "https://admin.u-site.app" {
|
||||
t.Fatalf("getPublicURL() = %q, want https://admin.u-site.app", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAbsAppURLUsesPublicURL(t *testing.T) {
|
||||
app.Http = &config.AppConfig{
|
||||
Server: config.ServerConfig{
|
||||
Url: "http://localhost:8080",
|
||||
PublicUrl: "https://admin.u-site.app",
|
||||
Port: "8080",
|
||||
},
|
||||
}
|
||||
got := absAppURL("/portal/proyecto/bot?tab=Tickets&ticket=1")
|
||||
want := "https://admin.u-site.app/portal/proyecto/bot?tab=Tickets&ticket=1"
|
||||
if got != want {
|
||||
t.Fatalf("absAppURL() = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAbsAppURLFallsBackToAppURL(t *testing.T) {
|
||||
app.Http = &config.AppConfig{
|
||||
Server: config.ServerConfig{
|
||||
Url: "http://localhost",
|
||||
@@ -34,8 +62,8 @@ func TestAbsAppURLRelativePath(t *testing.T) {
|
||||
}
|
||||
|
||||
func TestTelegramHTMLLinkEscapesAmpersand(t *testing.T) {
|
||||
link := telegramHTMLLink("http://localhost:8084/portal/p?tab=Tickets&ticket=1", "Ver portal")
|
||||
if link != `<a href="http://localhost:8084/portal/p?tab=Tickets&ticket=1">Ver portal</a>` {
|
||||
link := telegramHTMLLink("https://admin.u-site.app/portal/p?tab=Tickets&ticket=1", "Ver portal")
|
||||
if link != `<a href="https://admin.u-site.app/portal/p?tab=Tickets&ticket=1">Ver portal</a>` {
|
||||
t.Fatalf("telegramHTMLLink() = %q", link)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user