Skip to content

Commit 6f81139

Browse files
author
DogLooksGood
committed
Fix secrets flush in TestContext
1 parent 630561b commit 6f81139

File tree

2 files changed

+9
-3
lines changed

2 files changed

+9
-3
lines changed

test/src/client_helpers.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -203,6 +203,10 @@ impl TestClient {
203203
pub fn answer(&mut self, decision_id: DecisionId, answer: String) -> Result<Event> {
204204
self.client.answer_event(decision_id, answer)
205205
}
206+
207+
pub fn flush_secret_state(&mut self) {
208+
self.client.flush_secret_states();
209+
}
206210
}
207211

208212
#[cfg(test)]

test/src/handler_helpers.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,13 @@ impl<H: GameHandler> TestHandler<H> {
113113
context.cancel_dispatch();
114114
}
115115
}
116-
// Handle events (responses) from Clients/transactor(s) after they see updated ctx
117-
for i in 0..clients.len() {
118-
let c = clients.get_mut(i).unwrap();
116+
117+
for c in clients.iter_mut() {
119118
let cli_evts = c.handle_updated_context(context)?;
120119
evts.extend_from_slice(&cli_evts);
120+
if event_effects.checkpoint.is_some() {
121+
c.flush_secret_state();
122+
}
121123
}
122124

123125
if let Some(dispatch) = context.get_dispatch() {

0 commit comments

Comments
 (0)