Skip to content

Commit 810036b

Browse files
committed
test(cli): add integration test for model persistence in resumed /status
New test: resumed_status_surfaces_persisted_model - Creates session with model='claude-sonnet-4-6' - Resumes with --output-format json /status - Asserts model round-trips through session metadata Resume integration tests: 11 → 12.
1 parent 0f34c66 commit 810036b

1 file changed

Lines changed: 41 additions & 0 deletions

File tree

rust/crates/rusty-claude-cli/tests/resume_slash_commands.rs

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -276,6 +276,47 @@ fn resumed_status_command_emits_structured_json_when_requested() {
276276
assert!(parsed["sandbox"]["filesystem_mode"].as_str().is_some());
277277
}
278278

279+
#[test]
280+
fn resumed_status_surfaces_persisted_model() {
281+
// given — create a session with model already set
282+
let temp_dir = unique_temp_dir("resume-status-model");
283+
fs::create_dir_all(&temp_dir).expect("temp dir should exist");
284+
let session_path = temp_dir.join("session.jsonl");
285+
286+
let mut session = Session::new();
287+
session.model = Some("claude-sonnet-4-6".to_string());
288+
session
289+
.push_user_text("model persistence fixture")
290+
.expect("write ok");
291+
session.save_to_path(&session_path).expect("persist ok");
292+
293+
// when
294+
let output = run_claw(
295+
&temp_dir,
296+
&[
297+
"--output-format",
298+
"json",
299+
"--resume",
300+
session_path.to_str().expect("utf8 path"),
301+
"/status",
302+
],
303+
);
304+
305+
// then
306+
assert!(
307+
output.status.success(),
308+
"stderr:\n{}",
309+
String::from_utf8_lossy(&output.stderr)
310+
);
311+
let stdout = String::from_utf8(output.stdout).expect("utf8");
312+
let parsed: Value = serde_json::from_str(stdout.trim()).expect("should be json");
313+
assert_eq!(parsed["kind"], "status");
314+
assert_eq!(
315+
parsed["model"], "claude-sonnet-4-6",
316+
"model should round-trip through session metadata"
317+
);
318+
}
319+
279320
#[test]
280321
fn resumed_sandbox_command_emits_structured_json_when_requested() {
281322
// given

0 commit comments

Comments
 (0)