aboutsummaryrefslogtreecommitdiffstats
path: root/zellij-server/src/unit/screen_tests.rs
diff options
context:
space:
mode:
authorAram Drevekenin <aram@poor.dev>2023-06-15 17:07:40 +0200
committerGitHub <noreply@github.com>2023-06-15 17:07:40 +0200
commitbcbd940bf94cd76751af9b5fad64b716ce2cd3e6 (patch)
tree3bfed3792edd57f074c4aed9093c90bc6ed215fe /zellij-server/src/unit/screen_tests.rs
parentdocs(changelog): relative plugin urls (diff)
downloadsl0ppij-bcbd940bf94cd76751af9b5fad64b716ce2cd3e6.tar.gz
sl0ppij-bcbd940bf94cd76751af9b5fad64b716ce2cd3e6.tar.xz
sl0ppij-bcbd940bf94cd76751af9b5fad64b716ce2cd3e6.zip
feat(plugins): plugin pane state events (#2545)
* feat(plugins): report pane state to plugins * refactor(plugins): rename some stuff * tests(plugins): adjust for new behavior * style(fmt): rustfmt
Diffstat (limited to 'zellij-server/src/unit/screen_tests.rs')
-rw-r--r--zellij-server/src/unit/screen_tests.rs42
1 files changed, 33 insertions, 9 deletions
diff --git a/zellij-server/src/unit/screen_tests.rs b/zellij-server/src/unit/screen_tests.rs
index 51dfbfd3..1040062b 100644
--- a/zellij-server/src/unit/screen_tests.rs
+++ b/zellij-server/src/unit/screen_tests.rs
@@ -10,7 +10,7 @@ use crate::{
use insta::assert_snapshot;
use std::path::PathBuf;
use zellij_utils::cli::CliAction;
-use zellij_utils::data::Resize;
+use zellij_utils::data::{Event, Resize};
use zellij_utils::errors::{prelude::*, ErrorContext};
use zellij_utils::input::actions::Action;
use zellij_utils::input::command::{RunCommand, TerminalAction};
@@ -2431,10 +2431,22 @@ pub fn send_cli_rename_tab() {
send_cli_action_to_server(&session_metadata, rename_tab, client_id);
std::thread::sleep(std::time::Duration::from_millis(100));
mock_screen.teardown(vec![plugin_thread, screen_thread]);
- assert_snapshot!(format!(
- "{:#?}",
- *received_plugin_instructions.lock().unwrap()
- ))
+ let plugin_rename_tab_instruction = received_plugin_instructions
+ .lock()
+ .unwrap()
+ .iter()
+ .find(|instruction| match instruction {
+ PluginInstruction::Update(updates) => updates
+ .iter()
+ .find(|u| match u {
+ (_, _, Event::TabUpdate(..)) => true,
+ _ => false,
+ })
+ .is_some(),
+ _ => false,
+ })
+ .cloned();
+ assert_snapshot!(format!("{:#?}", plugin_rename_tab_instruction))
}
#[test]
@@ -2469,10 +2481,22 @@ pub fn send_cli_undo_rename_tab() {
send_cli_action_to_server(&session_metadata, undo_rename_tab, client_id);
std::thread::sleep(std::time::Duration::from_millis(100));
mock_screen.teardown(vec![plugin_thread, screen_thread]);
- assert_snapshot!(format!(
- "{:#?}",
- *received_plugin_instructions.lock().unwrap()
- ))
+ let plugin_undo_rename_tab_instruction = received_plugin_instructions
+ .lock()
+ .unwrap()
+ .iter()
+ .find(|instruction| match instruction {
+ PluginInstruction::Update(updates) => updates
+ .iter()
+ .find(|u| match u {
+ (_, _, Event::TabUpdate(..)) => true,
+ _ => false,
+ })
+ .is_some(),
+ _ => false,
+ })
+ .cloned();
+ assert_snapshot!(format!("{:#?}", plugin_undo_rename_tab_instruction))
}
#[test]