()
| 240 | |
| 241 | #[test] |
| 242 | fn enqueue_and_dequeue() { |
| 243 | let mut dlq = DeadLetterQueue::new(10); |
| 244 | let c = test_constraint(); |
| 245 | |
| 246 | let id = dlq |
| 247 | .enqueue( |
| 248 | 42, |
| 249 | 0, |
| 250 | 0, |
| 251 | b"delta-bytes".to_vec(), |
| 252 | &c, |
| 253 | "email already exists".into(), |
| 254 | CompensationHint::RetryWithDifferentValue { |
| 255 | field: "email".into(), |
| 256 | conflicting_value: "alice@example.com".into(), |
| 257 | suggestion: "alice+1@example.com".into(), |
| 258 | }, |
| 259 | ) |
| 260 | .unwrap(); |
| 261 | |
| 262 | assert_eq!(dlq.len(), 1); |
| 263 | assert_eq!(id, 1); |
| 264 | |
| 265 | let dl = dlq.dequeue().unwrap(); |
| 266 | assert_eq!(dl.peer_id, 42); |
| 267 | assert_eq!(dl.violated_constraint, "users_email_unique"); |
| 268 | assert!(dlq.is_empty()); |
| 269 | } |
| 270 | |
| 271 | #[test] |
| 272 | fn capacity_enforced() { |
nothing calls this directly
no test coverage detected