Files
imeai-aKode/akode-rs/state/src/delegated_preview_tests.rs
andrea.difonzo 203cd7a3f6 Marchio: allineamento fine della rinomina (A)
Le righe che differivano dalla rinomina di aKode solo per codex/akode (header e user agent
codex_cli_rs -> akode_cli_rs, nomi di file, testi di test) sono riportate come in aKode 0.9.2;
dove la mappa automatica aveva rinominato troppo (stringhe di protocollo, residenza) e'
ripristinato il testo originale.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
2026-11-17 12:53:28 +01:00

50 lines
1.7 KiB
Rust

//! Verify delegated preview decoding and tool identity filtering.
use super::delegated_output_preview;
use akode_protocol::items::FunctionCallOutputItem;
use akode_protocol::models::FunctionCallOutputBody;
use pretty_assertions::assert_eq;
#[test]
fn delegated_previews_unwrap_only_recognized_inputs() {
let wrapped = "<codex_delegation>\n <source_thread_id>source</source_thread_id>\n <input>Check &lt;main&gt; &amp; &amp;lt;literal&amp;gt;</input>\n</codex_delegation>";
for (namespace, name, text, expected) in [
(
Some("codex_app"),
"create_thread",
wrapped,
Some("Check <main> & &lt;literal&gt;"),
),
(
Some("codex_tui"),
"send_message_to_thread",
wrapped,
Some("Check <main> & &lt;literal&gt;"),
),
(
Some("codex_app"),
"create_thread",
"plain &lt;text&gt;",
Some("plain &lt;text&gt;"),
),
(Some("codex_tui"), "create_thread", " ", None),
(Some("other"), "create_thread", wrapped, None),
(None, "create_thread", wrapped, None),
(Some("codex_app"), "shell", wrapped, None),
(
Some("codex_app"),
"create_thread",
"<codex_delegation>incomplete",
Some("<codex_delegation>incomplete"),
),
] {
let output = FunctionCallOutputItem {
id: "output".to_string(),
name: name.to_string(),
namespace: namespace.map(str::to_string),
output: FunctionCallOutputBody::Text(text.to_string()),
};
assert_eq!(delegated_output_preview(&output).as_deref(), expected);
}
}