feat(chat): persistance bornee du brouillon custom chat par projet/layout (#182)
This commit is contained in:
26
crates/domain/tests/chat_draft.rs
Normal file
26
crates/domain/tests/chat_draft.rs
Normal 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 { .. }));
|
||||
}
|
||||
Reference in New Issue
Block a user