feat(chat): persistance bornee du brouillon custom chat par projet/layout (#182)

This commit is contained in:
2026-08-11 16:24:20 +02:00
parent 25ad44a3d9
commit 94b4ce7e5f
23 changed files with 1552 additions and 70 deletions

View File

@ -0,0 +1,26 @@
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 { .. }));
}