From b41486e7b3eac93740a22df619d2f82c26995c9e Mon Sep 17 00:00:00 2001
From: Robin Mueller <robin.mueller.m@gmail.com>
Date: Thu, 23 Jan 2025 16:53:54 +0100
Subject: [PATCH] basic test suite for exec helper done

---
 satrs/src/subsystem.rs | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/satrs/src/subsystem.rs b/satrs/src/subsystem.rs
index 21f8bc1..2c5ac76 100644
--- a/satrs/src/subsystem.rs
+++ b/satrs/src/subsystem.rs
@@ -173,7 +173,6 @@ impl SequenceExecutionHelper {
     /// Confirm that a sequence which is awaiting a success check is done
     pub fn confirm_sequence_done(&mut self) {
         if let SequenceExecutionHelperState::AwaitingSuccessCheck = self.state {
-            self.current_sequence_index = Some(self.current_sequence_index.unwrap() + 1);
             self.state = SequenceExecutionHelperState::Busy;
             if let (Some(last_sequence_index), Some(current_sequence_index)) =
                 (self.last_sequence_index, self.current_sequence_index)
@@ -182,6 +181,7 @@ impl SequenceExecutionHelper {
                     self.state = SequenceExecutionHelperState::Idle;
                 }
             }
+            self.current_sequence_index = Some(self.current_sequence_index.unwrap() + 1);
         }
     }
 
@@ -638,7 +638,10 @@ mod tests {
                     .unwrap(),
                 ModeCommandingResult::Done
             );
-            assert!(self.execution_helper.state() == SequenceExecutionHelperState::Idle);
+            assert_eq!(
+                self.execution_helper.state(),
+                SequenceExecutionHelperState::Idle
+            );
             assert!(self.sender.requests.borrow().is_empty());
         }
 
@@ -987,6 +990,8 @@ mod tests {
         assert!(tb.execution_helper.awaiting_success_check());
         assert_eq!(tb.execution_helper.current_sequence_index().unwrap(), 1);
         tb.generic_checks_subsystem_md1_step1(expected_req_id);
+        tb.execution_helper.confirm_sequence_done();
+        tb.check_run_is_no_op();
     }
 
     // TODO: Test subsystem commanding helper