Files
codex-proxy-rs/backend/crates/gateway-admin/tests/model/account_groups.rs
T
ZyyandCodex 0bfeff28fc refactor(backend): centralize shared models and settings validation
Reuse domain models for observability, account statistics, execution facts,
and group validation. Compose shared settings values while preserving
HTTP and SDK contracts and explicit storage and runtime boundaries.

Verify serialization, concurrency, persistence, and snapshot behavior with
3528 backend tests, strict Clippy, formatting, and architecture checks.

Co-authored-by: Codex <noreply@openai.com>
2026-10-07 02:32:53 +08:00

18 lines
781 B
Rust

//! 验证分组文本共用规则中的字符数、字节数和控制字符边界
use gateway_admin::model::account_groups::validate_group_fields;
#[test]
fn group_fields_distinguish_name_characters_from_description_bytes() {
let name = "组".repeat(100);
let description = "é".repeat(2048);
assert!(validate_group_fields(&name, Some(&description)).is_ok());
assert!(validate_group_fields(&"组".repeat(101), None).is_err());
assert!(validate_group_fields("组", Some(&"é".repeat(2049))).is_err());
for name in ["", " 组", "组 ", "组\n名"] {
assert!(validate_group_fields(name, None).is_err());
}
assert!(validate_group_fields("组", Some("含\t制表符")).is_err());
assert!(validate_group_fields("组", Some("")).is_ok());
}