mason5052
62dbefdd25
test: fill coverage gaps in server/models validation tests
...
Add missing test coverage identified by cross-review:
New files:
- assistants_test.go: AssistantStatus enum, Assistant struct, CreateAssistant,
PatchAssistant (stop/input actions), AssistantFlow nested validation
- prompts_test.go: PromptType enum (8 valid constants from templates pkg),
Prompt struct, PatchPrompt validation
Extended existing files:
- users_test.go: add AuthCallback positive-path test, UserRolePrivileges
validation, fix brittle double-call assertion in UserPreferences test
- api_tokens_test.go: add APITokenWithSecret validation (valid, invalid
embedded token, invalid JWT)
- flows_test.go: add Flow.Valid, FlowTasksSubtasks.Valid,
FlowContainers.Valid, Task.Valid, TaskSubtasks.Valid, Subtask.Valid,
Container.Valid with valid/invalid/missing-field cases
2026-03-31 21:53:39 -04:00
mason5052
5d4638e79d
test: add unit tests for server/models validation functions
...
Add comprehensive test coverage for the server/models package validation
logic including enum types, struct validators, and custom validators.
Test files added:
- users_test.go: UserStatus, UserType, Login, Password, User,
UserPassword, AuthCallback, UserRole, UserPreferences validation
- providers_test.go: ProviderType, Provider, CreateProvider,
PatchProvider, ProviderInfo validation
- api_tokens_test.go: TokenStatus, APIToken, CreateAPITokenRequest,
UpdateAPITokenRequest, APITokenClaims validation
- flows_test.go: FlowStatus, TaskStatus, SubtaskStatus, ContainerStatus,
ContainerType, Role, Privilege, RolePrivileges, PatchFlow validation
- init_test.go: Custom validators (stpass, vmail, oauth_min_scope,
solid, semver, semverex) and scanFromJSON helper
2026-03-31 20:36:51 -04:00