use domain::{ChatDraft, ChatDraftError, ChatDraftKey, LayoutId, NodeId, ProjectId}; use uuid::Uuid; fn key() -> ChatDraftKey { ChatDraftKey::new( ProjectId::from_uuid(Uuid::from_u128(1)), LayoutId::from_uuid(Uuid::from_u128(2)), NodeId::from_uuid(Uuid::from_u128(3)), ) } #[test] fn chat_draft_accepts_text_and_scope() { let draft = ChatDraft::new(key(), "hello", 42).unwrap(); assert_eq!(draft.key, key()); assert_eq!(draft.text, "hello"); assert_eq!(draft.updated_at_ms, 42); } #[test] fn chat_draft_rejects_oversized_text() { let err = ChatDraft::new(key(), "x".repeat(domain::CHAT_DRAFT_MAX_BYTES + 1), 42).unwrap_err(); assert!(matches!(err, ChatDraftError::TooLarge { .. })); }