From 93d13f7fd8b484fd06f1b1bc7c55a37453bb1715 Mon Sep 17 00:00:00 2001 From: Mike Smith <10135646+mikesmithgh@users.noreply.github.com> Date: Fri, 27 Sep 2024 16:46:12 -0400 Subject: [PATCH] test: update checkhealth test assertion --- .../kitty_scrollback_config_demo_04_spec.lua | 40 ++++++++-------- .../kitty_scrollback_spec.lua | 46 +++++++++---------- 2 files changed, 44 insertions(+), 42 deletions(-) diff --git a/tests/kitty-scrollback/kitty_scrollback_config_demo_04_spec.lua b/tests/kitty-scrollback/kitty_scrollback_config_demo_04_spec.lua index 27c1058f..2d37ef47 100644 --- a/tests/kitty-scrollback/kitty_scrollback_config_demo_04_spec.lua +++ b/tests/kitty-scrollback/kitty_scrollback_config_demo_04_spec.lua @@ -95,7 +95,7 @@ describe('kitty-scrollback.nvim', function() }) h.assert_screen_equals( h.feed_kitty({ - h.with_pause_seconds_before(h.send_without_newline([[a]])), + h.with_pause_seconds_before(h.send_without_newline([[a]]), 2), h.send_without_newline(h.send_as_string([[ # example > --config ksb_example_paste_win_register_disabled paste_window yank_register_enabled is set to false @@ -222,7 +222,7 @@ Press ENTER or type command to continue }) h.assert_screen_equals( h.feed_kitty({ - h.with_pause_seconds_before(h.send_without_newline([[a]])), + h.with_pause_seconds_before(h.send_without_newline([[a]]), 2), h.send_without_newline(h.send_as_string([[ # example > --config ksb_example_paste_win_register paste_window yank_register is set to * @@ -341,7 +341,7 @@ Press ENTER or type command to continue }) h.assert_screen_equals( h.feed_kitty({ - h.with_pause_seconds_before(h.send_without_newline([[a]])), + h.with_pause_seconds_before(h.send_without_newline([[a]]), 2), h.send_without_newline(h.send_as_string([[ # example > --config ksb_example_paste_win_winblend paste_window winblend set to 50 @@ -398,7 +398,7 @@ $šŸ­¼ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā– }) h.assert_screen_equals( h.feed_kitty({ - h.with_pause_seconds_before(h.send_without_newline([[a]])), + h.with_pause_seconds_before(h.send_without_newline([[a]]), 2), h.send_without_newline(h.send_as_string([[ # example > --config ksb_example_paste_win_winopts Customized paste winopts with maximized window and winblend @@ -452,7 +452,7 @@ $ }) h.assert_screen_equals( h.feed_kitty({ - h.with_pause_seconds_before(h.send_without_newline([[a]])), + h.with_pause_seconds_before(h.send_without_newline([[a]]), 2), h.send_without_newline(h.send_as_string([[ # example > --config ksb_example_restore_opts restore_options is true, original values of overridden options have been restored. For example, line numbers @@ -509,7 +509,7 @@ tšŸ­¼ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā– }) h.assert_screen_equals( h.feed_kitty({ - h.with_pause_seconds_before(h.send_without_newline([[a]])), + h.with_pause_seconds_before(h.send_without_newline([[a]]), 2), h.send_without_newline(h.send_as_string([[ # example > --config ksb_example_status_win_disabled status_window is disabled, notice no status window is displayed in the top right of the screen @@ -564,7 +564,7 @@ $šŸ­¼ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā–ā– }) h.assert_screen_equals( h.feed_kitty({ - h.with_pause_seconds_before(h.send_without_newline([[a]])), + h.with_pause_seconds_before(h.send_without_newline([[a]]), 2), h.send_without_newline(h.send_as_string([[ # example > --no-nvim-args --env NVIM_APPNAME=ksb-nvim NVIM_APPNAME is set to ksb-nvim @@ -672,7 +672,7 @@ Press ENTER or type command to continue }) h.assert_screen_equals( h.feed_kitty({ - h.with_pause_seconds_before(h.send_without_newline([[a]])), + h.with_pause_seconds_before(h.send_without_newline([[a]]), 2), h.with_pause_seconds_before(h.send_without_newline(h.send_as_string([[ # example > --no-nvim-args -c 'colorscheme darkblue' Yo, listen up here's a story @@ -733,17 +733,21 @@ Press ENTER or type command to continue '--config', 'ksb_builtin_checkhealth', }) - h.assert_screen_starts_with(h.feed_kitty(), { - stdout = [[ - -ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ -kitty-scrollback: require("kitty-scrollback.health").check() - -kitty-scrollback: Neovim version + h.assert_screen_match( + h.feed_kitty({ + h.with_pause_seconds_before([[:set conceallevel=0]]), + }), + { + pattern = [[ +kitty%-scrollback:.*require%("kitty%-scrollback.health"%).check%(%) +.*kitty%-scrollback: Neovim version.*~ +.*%- OK NVIM.* ]], - cursor_y = 1, - cursor_x = 1, - }) + + cursor_y = 1, + cursor_x = 1, + } + ) end) after_all() diff --git a/tests/kitty-scrollback/kitty_scrollback_spec.lua b/tests/kitty-scrollback/kitty_scrollback_spec.lua index 888d257b..fd2f88d7 100644 --- a/tests/kitty-scrollback/kitty_scrollback_spec.lua +++ b/tests/kitty-scrollback/kitty_scrollback_spec.lua @@ -115,23 +115,22 @@ $ brew search a h.send_as_string( [[nvim +'lua vim.opt.rtp:append("../..") vim.opt.rtp:append("../../kitty-scrollback.nvim") require("kitty-scrollback").setup() vim.cmd("KittyScrollbackCheckHealth")']] ), + h.with_pause_seconds_before([[:set conceallevel=0]]), }) h.assert_screen_not_match( actual, { pattern = 'ERROR', cursor_y = 1, cursor_x = 1 }, 'kitty-scrollback.nvim checkhealth had an unexpected health check ERROR' ) - h.assert_screen_starts_with(actual, { - stdout = [[ - -ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ -kitty-scrollback: require("kitty-scrollback.health").check() - -kitty-scrollback: Neovim version + h.assert_screen_match(actual, { + pattern = [[ +kitty%-scrollback:.*require%("kitty%-scrollback.health"%).check%(%) +.*kitty%-scrollback: Neovim version.*~ +.*%- OK NVIM.* ]], cursor_y = 1, cursor_x = 1, - }, 'kitty-scrollback.nvim checkhealth content did not start with expected content') + }) end) it('should successfully open checkhealth and warn user no kitty data available', function() @@ -140,6 +139,7 @@ kitty-scrollback: Neovim version [[nvim +'lua vim.opt.rtp:append("../..") vim.opt.rtp:append("../../kitty-scrollback.nvim") require("kitty-scrollback").setup() vim.cmd("checkhealth kitty-scrollback")']] ), h.send_without_newline([[zR]]), + h.with_pause_seconds_before([[:set conceallevel=0]]), }) h.assert_screen_not_match( actual, @@ -151,17 +151,15 @@ kitty-scrollback: Neovim version cursor_y = 1, cursor_x = 1, }) - h.assert_screen_starts_with(actual, { - stdout = [[ - -ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ā”€ -kitty-scrollback: require("kitty-scrollback.health").check() - -kitty-scrollback: Neovim version + h.assert_screen_match(actual, { + pattern = [[ +kitty%-scrollback:.*require%("kitty%-scrollback.health"%).check%(%) +.*kitty%-scrollback: Neovim version.*~ +.*%- OK NVIM.* ]], cursor_y = 1, cursor_x = 1, - }, 'kitty-scrollback.nvim checkhealth content did not start with expected content') + }) end) it('should paste command to kitty in bracketed paste mode', function() @@ -169,7 +167,7 @@ kitty-scrollback: Neovim version h.feed_kitty({ h.send_as_string([[\n\n]]), h.open_kitty_scrollback_nvim(), - [[acat <