fix: honest review update rollback test, goal delete NotFound fake, read before write

This commit is contained in:
2026-10-26 00:52:45 +01:00
parent 62ad9f4017
commit 2f133afb96
4 changed files with 20 additions and 7 deletions

View File

@@ -50,7 +50,11 @@ impl GoalCommand for InMemoryStore {
_user_id: &UserId,
events: &[DomainEvent],
) -> Result<(), DomainError> {
self.goals.write().unwrap().remove(&id.value());
self.goals
.write()
.unwrap()
.remove(&id.value())
.ok_or_else(|| DomainError::NotFound("Goal not found".into()))?;
self.record_events(events);
Ok(())
}