21
0
Fork 0

add BuildUrl test
Build Docker and Deploy / Run goext test-suite (push) Successful in 2m59s Details

This commit is contained in:
Timo Vetter 2024-02-09 12:27:18 +01:00
parent 1c7dc1820a
commit 885bb53244
1 changed files with 45 additions and 0 deletions

45
langext/url_test.go Normal file
View File

@ -0,0 +1,45 @@
package langext
import (
"gogs.mikescher.com/BlackForestBytes/goext/tst"
"testing"
)
func TestBuildUrl(t *testing.T) {
tests := []struct {
Url string
Path string
Params *map[string]string
Want string
}{
{
Url: "https://test.heydyno.de/",
Path: "/testing-01",
Params: &map[string]string{"param1": "value1"},
Want: "https://test.heydyno.de/testing-01?param1=value1",
},
{
Url: "https://test.heydyno.de",
Path: "testing-01",
Params: &map[string]string{"param1": "value1"},
Want: "https://test.heydyno.de/testing-01?param1=value1",
},
{
Url: "https://test.heydyno.de",
Path: "/testing-01",
Params: nil,
Want: "https://test.heydyno.de/testing-01",
},
{
Url: "https://test.heydyno.de/",
Path: "testing-01",
Params: nil,
Want: "https://test.heydyno.de/testing-01",
},
}
for _, test := range tests {
res := BuildUrl(test.Url, test.Path, test.Params)
tst.AssertEqual(t, res, test.Want)
}
}