[#275] added support to customize the default user email templates from the Admin UI

This commit is contained in:
Gani Georgiev
2022-08-14 19:30:45 +03:00
parent 1de56d3d9e
commit 7d10d20de1
47 changed files with 1648 additions and 1188 deletions
+40
View File
@@ -0,0 +1,40 @@
package rest_test
import (
"testing"
"github.com/pocketbase/pocketbase/tools/rest"
)
func TestNormalizeUrl(t *testing.T) {
scenarios := []struct {
url string
expectError bool
expectUrl string
}{
{":/", true, ""},
{"./", false, "./"},
{"../../test////", false, "../../test/"},
{"/a/b/c", false, "/a/b/c"},
{"a/////b//c/", false, "a/b/c/"},
{"/a/////b//c", false, "/a/b/c"},
{"///a/b/c", false, "/a/b/c"},
{"//a/b/c", false, "//a/b/c"}, // preserve "auto-schema"
{"http://a/b/c", false, "http://a/b/c"},
{"a//bc?test=1//dd", false, "a/bc?test=1//dd"}, // only the path is normalized
{"a//bc?test=1#12///3", false, "a/bc?test=1#12///3"}, // only the path is normalized
}
for i, s := range scenarios {
result, err := rest.NormalizeUrl(s.url)
hasErr := err != nil
if hasErr != s.expectError {
t.Errorf("(%d) Expected hasErr %v, got %v", i, s.expectError, hasErr)
}
if result != s.expectUrl {
t.Errorf("(%d) Expected url %q, got %q", i, s.expectUrl, result)
}
}
}