Skip to content

Commit 805b73b

Browse files
author
Nitish [C] Dhok
committed
kiro-cli-e2e tests: added new feature kiro-cli init and its subcommand. partially completed.
1 parent 9227547 commit 805b73b

File tree

4 files changed

+146
-0
lines changed

4 files changed

+146
-0
lines changed

e2etests/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,3 +52,4 @@ kiro_steering = [] # Kiro Steering Tests
5252
sub_integrations = [] # Kiro-Cli integrations subcommand
5353
setup_subcommands = [] # KIRO-CLI setup subcommand
5454
diagnostics = [] # KIRO-CLI diagnostics subcommand
55+
init = [] # KIRO-CLI init subcommand

e2etests/tests/all_tests.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ mod kiro_steering;
1616
mod sub_integrations;
1717
mod setup_subcommands;
1818
mod diagnostics;
19+
mod init;
1920

2021
use q_cli_e2e_tests::q_chat_helper;
2122

e2etests/tests/init/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pub mod test_kiro_cli_init_subcommand;
Lines changed: 143 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
#[allow(unused_imports)]
2+
use q_cli_e2e_tests::q_chat_helper;
3+
4+
#[test]
5+
#[cfg(all(feature = "init", feature = "sanity"))]
6+
fn test_kiro_cli_init_help_subommand() -> Result<(), Box<dyn std::error::Error>> {
7+
println!("\n🔍 Testing kiro-cli init --help ... | Description: Tests the <code> kiro-cli init --help </code> subcommand to verify help options.");
8+
9+
println!("\n🔍 Executing 'kiro-cli init --help' subcommand...");
10+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","--help"])?;
11+
12+
println!("📝 FULL OUTPUT:");
13+
println!("{}", response);
14+
println!("📝 END OUTPUT");
15+
16+
assert!(response.contains("Options:"), "Expected 'Options:' in the output");
17+
assert!(response.contains("Arguments"), "Expected 'Arguments' in the output");
18+
assert!(response.contains("SHELL"), "Expected 'SHELL' in the output");
19+
20+
assert!(response.contains("bash"), "Expected 'bash' in the output");
21+
assert!(response.contains("zsh"), "Expected 'zsh' in the output");
22+
assert!(response.contains("fish"), "Expected 'fish' in the output");
23+
24+
assert!(response.contains("nu"), "Expected 'nu' in the output");
25+
assert!(response.contains("WHEN"), "Expected 'WHEN' in the output");
26+
assert!(response.contains("RCFILE"), "Expected 'RCFILE' in the output");
27+
28+
assert!(response.contains("rcfile"), "Expected 'rcfile' in the output");
29+
30+
assert!(response.contains("-v"), "Expected '-v' in the output");
31+
assert!(response.contains("--verbose"), "Expected '--verbose' in the output");
32+
33+
assert!(response.contains("-h"), "Expected '-h' in the output");
34+
assert!(response.contains("--help"), "Expected '--help' in the output");
35+
36+
println!("✅ Kiro Cli init --help subcommand executed successfully!");
37+
38+
Ok(())
39+
}
40+
41+
#[test]
42+
#[cfg(all(feature = "init", feature = "sanity"))]
43+
fn test_kiro_cli_init_bash_pre_subommand() -> Result<(), Box<dyn std::error::Error>> {
44+
println!("\n🔍 Testing kiro-cli init bash pre ... | Description: Tests the <code> kiro-cli init bash pre </code> subcommand to verify bash pre init subcommand.");
45+
46+
println!("\n🔍 Executing 'kiro-cli init bash pre' subcommand...");
47+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","bash","pre"])?;
48+
49+
println!("📝 FULL OUTPUT:");
50+
println!("{}", response);
51+
println!("📝 END OUTPUT");
52+
53+
assert!(response.contains("SHOULD_QTERM_LAUNCH"), "Expected 'SHOULD_QTERM_LAUNCH' in the output");
54+
assert!(response.contains("function __fig_source_bash_preexec"), "Expected 'function __fig_source_bash_preexec' in the output");
55+
assert!(response.contains("bash-preexec.sh"), "Expected 'bash-preexec.sh' in the output");
56+
57+
assert!(response.contains("General Usage:"), "Expected 'General Usage:' in the output");
58+
assert!(response.contains("#!/usr/bin/env bash"), "Expected '#!/usr/bin/env bash' in the output");
59+
assert!(response.contains("https://github.com/rcaloras/bash-preexec"), "Expected 'https://github.com/rcaloras/bash-preexec' in the output");
60+
61+
assert!(response.contains("#"), "Expected '#' in the output");
62+
63+
println!("✅ Kiro Cli init bash pre subcommand executed successfully!");
64+
65+
Ok(())
66+
}
67+
68+
#[test]
69+
#[cfg(all(feature = "init", feature = "sanity"))]
70+
fn test_kiro_cli_init_bash_post_subommand() -> Result<(), Box<dyn std::error::Error>> {
71+
println!("\n🔍 Testing kiro-cli init bash post ... | Description: Tests the <code> kiro-cli init bash post </code> subcommand to verify kiro-cli init bash post subcommand.");
72+
73+
println!("\n🔍 Executing 'kiro-cli init bash post' subcommand...");
74+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","bash","post"])?;
75+
76+
println!("📝 FULL OUTPUT:");
77+
println!("{}", response);
78+
println!("📝 END OUTPUT");
79+
80+
assert!(response.contains("Q_SHELL"), "Expected 'Q_SHELL' in the output");
81+
assert!(response.contains("bash-preexec.sh"), "Expected 'bash-preexec.sh' in the output");
82+
83+
assert!(response.contains("General Usage:"), "Expected 'General Usage:' in the output");
84+
assert!(response.contains("https://github.com/rcaloras/bash-preexec"), "Expected 'https://github.com/rcaloras/bash-preexec' in the output");
85+
86+
assert!(response.contains("#"), "Expected '#' in the output");
87+
88+
println!("✅ Kiro Cli init bash post subcommand executed successfully!");
89+
90+
Ok(())
91+
}
92+
93+
#[test]
94+
#[cfg(all(feature = "init", feature = "sanity"))]
95+
fn test_kiro_cli_init_zsh_pre_subommand() -> Result<(), Box<dyn std::error::Error>> {
96+
println!("\n🔍 Testing kiro-cli init zsh pre ... | Description: Tests the <code> kiro-cli init zsh pre </code> subcommand to verify kiro-cli init zsh pre subcommand.");
97+
98+
println!("\n🔍 Executing 'kiro-cli init zsh pre' subcommand...");
99+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","zsh","pre"])?;
100+
101+
println!("📝 FULL OUTPUT:");
102+
println!("{}", response);
103+
println!("📝 END OUTPUT");
104+
105+
assert!(response.contains("Q_SHELL"), "Expected 'Q_SHELL' in the output");
106+
assert!(response.contains("SHOULD_QTERM_LAUNCH"), "Expected 'SHOULD_QTERM_LAUNCH' in the output");
107+
108+
assert!(response.contains("mkdir"), "Expected 'mkdir' in the output");
109+
assert!(response.contains("add"), "Expected 'add' in the output");
110+
111+
assert!(response.contains("#"), "Expected '#' in the output");
112+
113+
println!("✅ Kiro Cli init zsh pre subcommand executed successfully!");
114+
115+
Ok(())
116+
}
117+
118+
#[test]
119+
#[cfg(all(feature = "init", feature = "sanity"))]
120+
fn test_kiro_cli_init_zsh_post_subommand() -> Result<(), Box<dyn std::error::Error>> {
121+
println!("\n🔍 Testing kiro-cli init zsh post ... | Description: Tests the <code> kiro-cli init zsh post </code> subcommand to verify kiro-cli init zsh pre subcommand.");
122+
123+
println!("\n🔍 Executing 'kiro-cli init zsh post' subcommand...");
124+
let response = q_chat_helper::execute_q_subcommand("kiro-cli", &["init","zsh","post"])?;
125+
126+
println!("📝 FULL OUTPUT:");
127+
println!("{}", response);
128+
println!("📝 END OUTPUT");
129+
130+
assert!(response.contains("Q_SHELL"), "Expected 'Q_SHELL' in the output");
131+
assert!(response.contains("Global Configuration Variables"), "Expected 'Global Configuration Variables' in the output");
132+
133+
assert!(response.contains("Utility Functions"), "Expected 'Utility Functions' in the output");
134+
assert!(response.contains("Widget Helpers"), "Expected 'Widget Helpers' in the output");
135+
136+
assert!(response.contains("Highlighting"), "Expected 'Highlighting' in the output");
137+
assert!(response.contains("Autosuggest Widget Implementations"), "Expected 'Autosuggest Widget Implementations' in the output");
138+
assert!(response.contains("InlineShell Suggestion Strategy"), "Expected 'InlineShell Suggestion Strategy' in the output");
139+
140+
println!("✅ Kiro Cli init zsh post subcommand executed successfully!");
141+
142+
Ok(())
143+
}

0 commit comments

Comments
 (0)