1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
//! Integration tests for cueloop tutorial command.
//!
//! Purpose:
//! - Integration tests for cueloop tutorial command.
//!
//! Responsibilities:
//! - Provide focused implementation or regression coverage for this file's owning feature.
//!
//! Scope:
//! - Limited to this file's owning feature boundary.
//!
//!
//! Usage:
//! - Used through the crate module tree or integration test harness.
//!
//! Invariants/Assumptions:
//! - Keep behavior aligned with CueLoop's canonical CLI, machine-contract, and queue semantics.
use cueloop::commands::tutorial::{
ScriptedResponse, ScriptedTutorialPrompter, run_tutorial_with_prompter,
};
use serial_test::serial;
#[test]
#[serial]
fn tutorial_completes_with_scripted_prompter() {
// Create scripted responses for all pause points
let prompter = ScriptedTutorialPrompter::new(vec![
ScriptedResponse::Pause, // welcome
ScriptedResponse::Pause, // setup
ScriptedResponse::Pause, // init
ScriptedResponse::Pause, // create_task
ScriptedResponse::Pause, // dry_run
// review doesn't pause
// cleanup doesn't pause
]);
let result = run_tutorial_with_prompter(&prompter, false);
assert!(
result.is_ok(),
"tutorial should complete: {:?}",
result.err()
);
}
#[test]
#[serial]
fn tutorial_keeps_sandbox_when_requested() {
let prompter = ScriptedTutorialPrompter::new(vec![
ScriptedResponse::Pause,
ScriptedResponse::Pause,
ScriptedResponse::Pause,
ScriptedResponse::Pause,
ScriptedResponse::Pause,
]);
// Run with keep_sandbox=true - we can't easily verify the path persists
// but we can verify it doesn't error
let result = run_tutorial_with_prompter(&prompter, true);
assert!(
result.is_ok(),
"tutorial with keep_sandbox should complete: {:?}",
result.err()
);
}
#[test]
#[serial]
fn tutorial_handles_user_quit_gracefully() {
// This tests that if responses run out, we get an error (simulating quit)
let prompter = ScriptedTutorialPrompter::new(vec![
ScriptedResponse::Pause, // only one response, tutorial needs more
]);
let result = run_tutorial_with_prompter(&prompter, false);
assert!(
result.is_err(),
"tutorial should fail when responses exhausted"
);
}