1
0
mirror of https://github.com/taigrr/pastebin synced 2026-04-13 17:08:04 -07:00

test: extend test coverage for server, config, and utils

This commit is contained in:
2026-03-09 05:51:36 +00:00
parent db833cd37a
commit 0ca287cac2
3 changed files with 174 additions and 0 deletions

View File

@@ -22,3 +22,17 @@ func TestRandomStringUniqueness(t *testing.T) {
seen[result] = true
}
}
func TestRandomStringURLSafe(t *testing.T) {
for range 50 {
result := RandomString(32)
// base64 URL encoding uses A-Z, a-z, 0-9, -, _
for _, char := range result {
isValid := (char >= 'A' && char <= 'Z') ||
(char >= 'a' && char <= 'z') ||
(char >= '0' && char <= '9') ||
char == '-' || char == '_' || char == '='
assert.True(t, isValid, "RandomString contains invalid URL character: %c", char)
}
}
}