up
This commit is contained in:
@@ -0,0 +1,41 @@
|
||||
package services
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/sujit-baniya/fiber-boilerplate/app"
|
||||
"github.com/sujit-baniya/fiber-boilerplate/config"
|
||||
)
|
||||
|
||||
func TestGetAppURLLocalhostAddsPort(t *testing.T) {
|
||||
app.Http = &config.AppConfig{
|
||||
Server: config.ServerConfig{
|
||||
Url: "http://localhost",
|
||||
Port: "8084",
|
||||
},
|
||||
}
|
||||
if got := getAppURL(); got != "http://localhost:8084" {
|
||||
t.Fatalf("getAppURL() = %q, want http://localhost:8084", got)
|
||||
}
|
||||
}
|
||||
|
||||
func TestAbsAppURLRelativePath(t *testing.T) {
|
||||
app.Http = &config.AppConfig{
|
||||
Server: config.ServerConfig{
|
||||
Url: "http://localhost",
|
||||
Port: "8084",
|
||||
},
|
||||
}
|
||||
got := absAppURL("/app/tickets?ticket=3")
|
||||
want := "http://localhost:8084/app/tickets?ticket=3"
|
||||
if got != want {
|
||||
t.Fatalf("absAppURL() = %q, want %q", got, want)
|
||||
}
|
||||
}
|
||||
|
||||
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>` {
|
||||
t.Fatalf("telegramHTMLLink() = %q", link)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user