You've already forked pocketbase
mirror of
https://github.com/pocketbase/pocketbase.git
synced 2025-07-16 18:54:22 +02:00
initial public commit
This commit is contained in:
31
forms/realtime_subscribe_test.go
Normal file
31
forms/realtime_subscribe_test.go
Normal file
@ -0,0 +1,31 @@
|
||||
package forms_test
|
||||
|
||||
import (
|
||||
"strings"
|
||||
"testing"
|
||||
|
||||
"github.com/pocketbase/pocketbase/forms"
|
||||
)
|
||||
|
||||
func TestRealtimeSubscribeValidate(t *testing.T) {
|
||||
scenarios := []struct {
|
||||
clientId string
|
||||
expectError bool
|
||||
}{
|
||||
{"", true},
|
||||
{strings.Repeat("a", 256), true},
|
||||
{"test", false},
|
||||
}
|
||||
|
||||
for i, s := range scenarios {
|
||||
form := forms.NewRealtimeSubscribe()
|
||||
form.ClientId = s.clientId
|
||||
|
||||
err := form.Validate()
|
||||
|
||||
hasErr := err != nil
|
||||
if hasErr != s.expectError {
|
||||
t.Errorf("(%d) Expected hasErr to be %v, got %v (%v)", i, s.expectError, hasErr, err)
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user