4cddfcf2f3
Backend Tests / Tests (other) (push) Failing after 1s
Backend Tests / Static Checks (push) Failing after 2s
Backend Tests / Tests (internal) (push) Failing after 2s
Backend Tests / Tests (server) (push) Failing after 1s
Backend Tests / Tests (store) (push) Failing after 1s
Build Canary Image / build-frontend (push) Failing after 1s
Frontend Tests / Lint (push) Failing after 1s
Build Canary Image / build-push (linux/amd64) (push) Has been skipped
Build Canary Image / build-push (linux/arm64) (push) Has been skipped
Build Canary Image / merge (push) Has been skipped
Frontend Tests / Build (push) Failing after 1s
Release Please / release-please (push) Failing after 0s
Proto Linter / Lint Protos (push) Failing after 2s
38 lines
849 B
Go
38 lines
849 B
Go
package base
|
|
|
|
import (
|
|
"testing"
|
|
)
|
|
|
|
func TestUIDMatcher(t *testing.T) {
|
|
tests := []struct {
|
|
input string
|
|
expected bool
|
|
}{
|
|
{"", false},
|
|
{"-abc123", false},
|
|
{"012345678901234567890123456789", true},
|
|
{"1abc-123", true},
|
|
{"A123B456C789", true},
|
|
{"a", true},
|
|
{"ab", true},
|
|
{"a*b&c", false},
|
|
{"a--b", true},
|
|
{"a-1b-2c", true},
|
|
{"a1234567890123456789012345678901", true},
|
|
{"abc123", true},
|
|
{"abc123-", false},
|
|
{"123e4567-e89b-12d3-a456-426614174000", true}, // UUID v4 from IDP
|
|
{"a123456789012345678901234567890123456", false}, // 37 characters (too long)
|
|
}
|
|
|
|
for _, test := range tests {
|
|
t.Run(test.input, func(*testing.T) {
|
|
result := UIDMatcher.MatchString(test.input)
|
|
if result != test.expected {
|
|
t.Errorf("For input '%s', expected %v but got %v", test.input, test.expected, result)
|
|
}
|
|
})
|
|
}
|
|
}
|