Implement EventCollector projector in eventcore-testing (ADR-031) #278

Closed
opened 2026-01-01 10:10:29 -08:00 by jwilger · 0 comments
jwilger commented 2026-01-01 10:10:29 -08:00 (Migrated from github.com)

Summary

Implement EventCollector<E> projector in eventcore-testing per ADR-031.

Context

ADR-031 (Black-Box Integration Testing via Projections) establishes that integration tests should verify command execution results via projections, not direct store.read_stream() access.

Requirements

  • Create EventCollector<E> struct that implements Projector
  • Collects all events of type E into a shared Arc<Mutex<Vec<E>>>
  • Export from eventcore_testing for use in tests

Example Usage

let collected = Arc::new(Mutex::new(Vec::new()));
let projector = EventCollector::new(collected.clone());
run_projection(projector, &backend).await?;
assert_eq!(collected.lock().unwrap().len(), expected_count);

Parent Issue

Sub-issue of #272

## Summary Implement `EventCollector<E>` projector in `eventcore-testing` per ADR-031. ## Context ADR-031 (Black-Box Integration Testing via Projections) establishes that integration tests should verify command execution results via projections, not direct `store.read_stream()` access. ## Requirements - Create `EventCollector<E>` struct that implements `Projector` - Collects all events of type `E` into a shared `Arc<Mutex<Vec<E>>>` - Export from `eventcore_testing` for use in tests ## Example Usage ```rust let collected = Arc::new(Mutex::new(Vec::new())); let projector = EventCollector::new(collected.clone()); run_projection(projector, &backend).await?; assert_eq!(collected.lock().unwrap().len(), expected_count); ``` ## Parent Issue Sub-issue of #272
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
jwilger/eventcore#278
No description provided.