fix(slash-commands): route /clean et /help en commandes natives IdeA avant dispatch plugin (#183)
This commit is contained in:
@ -386,6 +386,37 @@ mod tests {
|
||||
assert_eq!(arguments, vec![serde_json::json!({ "selection": "abc" })]);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn native_command_names_are_routed_before_plugin_commands() {
|
||||
let colliding_plugin = plugin_slash_command(
|
||||
"dev.acme.plugin",
|
||||
"dev.acme.plugin.clean",
|
||||
"/clean",
|
||||
"Plugin clean",
|
||||
false,
|
||||
SlashCommandAvailability::Available,
|
||||
)
|
||||
.unwrap();
|
||||
let sid = session();
|
||||
|
||||
let out = ExecuteSlashCommand::new(SlashCommandRegistry::new())
|
||||
.execute_with_plugins(
|
||||
ExecuteSlashCommandInput {
|
||||
name: "/clean".to_owned(),
|
||||
session_id: Some(sid),
|
||||
arguments: Vec::new(),
|
||||
},
|
||||
vec![colliding_plugin],
|
||||
)
|
||||
.unwrap();
|
||||
|
||||
assert_eq!(out.command.source, SlashCommandSource::Native);
|
||||
assert_eq!(
|
||||
out.effect,
|
||||
SlashCommandEffect::CleanConversation { session_id: sid }
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn runtime_catalog_plugin_slash_commands_feed_unified_registry() {
|
||||
let catalog = PluginRuntimeCatalog {
|
||||
|
||||
Reference in New Issue
Block a user