diff options
| author | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-21 17:37:31 +0300 |
|---|---|---|
| committer | Ogulcan Celik <ogulcancelik@gmail.com> | 2026-07-21 17:37:43 +0300 |
| commit | 1955406eafa37ae3d02d433d043b476e4a9a0bc4 (patch) | |
| tree | 8081633269d4371a9613f98b129e734243e400f0 /tests/cli | |
| parent | 6382bd433a66683d29455409e1dbb16776727bbf (diff) | |
fix: link plugins without a running server
refs #1670
Diffstat (limited to 'tests/cli')
| -rw-r--r-- | tests/cli/plugins.rs | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/tests/cli/plugins.rs b/tests/cli/plugins.rs index f76ae0a0..6726c243 100644 --- a/tests/cli/plugins.rs +++ b/tests/cli/plugins.rs @@ -111,6 +111,64 @@ fn named_sessions_share_live_plugin_registry() { } #[test] +fn plugin_link_works_offline_and_is_global() { + let base = unique_test_dir(); + let config_home = base.join("config"); + let runtime_dir = base.join("runtime"); + let state_home = base.join("state"); + let plugin_dir = base.join("plugins").join("offline"); + fs::create_dir_all(&plugin_dir).unwrap(); + fs::write( + plugin_dir.join("herdr-plugin.toml"), + r#" +id = "example.offline" +name = "Offline Plugin" +version = "0.1.0" +min_herdr_version = "0.6.10" +platforms = ["linux", "macos", "windows"] +"#, + ) + .unwrap(); + + let link_args = [ + "--session", + "offline", + "plugin", + "link", + plugin_dir.to_str().unwrap(), + "--disabled", + ]; + let linked = parse_cli_json_output( + &link_args, + run_named_cli_with_env( + &config_home, + &runtime_dir, + &link_args, + &[("XDG_STATE_HOME", &state_home)], + ), + ); + assert_eq!(linked["result"]["type"], "plugin_linked"); + assert_eq!(linked["result"]["plugin"]["plugin_id"], "example.offline"); + assert_eq!(linked["result"]["plugin"]["enabled"], false); + assert_eq!(linked["result"]["plugin"]["source"]["kind"], "local"); + assert!(!named_session_socket(&config_home, "offline").exists()); + + let listed = run_named_cli_json( + &config_home, + &runtime_dir, + &["--session", "other", "plugin", "list", "--json"], + ); + assert_eq!(listed["result"]["plugins"].as_array().unwrap().len(), 1); + assert_eq!( + listed["result"]["plugins"][0]["plugin_id"], + "example.offline" + ); + assert_eq!(listed["result"]["plugins"][0]["enabled"], false); + + cleanup_test_base(&base); +} + +#[test] fn plugin_install_through_named_server_is_global() { let base = unique_test_dir(); let config_home = base.join("config"); |
