Skip to content

Commit

Permalink
test: update checkhealth test assertion (#271)
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesmithgh authored Sep 28, 2024
1 parent 3f430ff commit d51725a
Show file tree
Hide file tree
Showing 4 changed files with 43 additions and 48 deletions.
29 changes: 14 additions & 15 deletions tests/kitty-scrollback/kitty_scrollback_config_demo_04_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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 *
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -733,14 +733,13 @@ 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(), {
pattern = [[
kitty%-scrollback:.*require%("kitty%-scrollback.health"%).check%(%)
.*kitty%-scrollback: Neovim version.*
.*%- OK NVIM.*
]],

cursor_y = 1,
cursor_x = 1,
})
Expand Down
6 changes: 3 additions & 3 deletions tests/kitty-scrollback/kitty_scrollback_fish_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ end
h.feed_kitty({
h.with_pause_seconds_before([[echo autocomplete test]]),
h.open_kitty_scrollback_nvim(),
h.send_without_newline([[a]]),
h.with_pause_seconds_before(h.send_without_newline([[a]])),
h.send_without_newline([[echo]]),
h.send_without_newline(h.control_enter()),
}),
Expand All @@ -77,7 +77,7 @@ fish $
h.feed_kitty({
h.with_pause_seconds_before([[echo autocomplete test]]),
h.open_kitty_scrollback_nvim(),
h.send_without_newline([[a]]),
h.with_pause_seconds_before(h.send_without_newline([[a]])),
h.send_without_newline([[echo]]),
h.send_without_newline(h.shift_enter()),
}),
Expand All @@ -97,7 +97,7 @@ fish $ echo autocomplete test
h.assert_screen_match(
h.feed_kitty({
h.open_kitty_scrollback_nvim(),
h.send_without_newline([[a]]),
h.with_pause_seconds_before(h.send_without_newline([[a]])),
h.send_without_newline(h.esc()),
[[:set filetype?]],
}),
Expand Down
44 changes: 20 additions & 24 deletions tests/kitty-scrollback/kitty_scrollback_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -121,17 +121,15 @@ $ brew search a
{ 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()
Expand All @@ -151,25 +149,23 @@ 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()
h.assert_screen_equals(
h.feed_kitty({
h.send_as_string([[\n\n]]),
h.open_kitty_scrollback_nvim(),
[[acat <<EOF]],
h.with_pause_seconds_before([[acat <<EOF]]),
h.send_as_string([[
line1
line2
Expand Down Expand Up @@ -204,7 +200,7 @@ $
h.feed_kitty({
h.send_as_string([[\n\n]]),
h.open_kitty_scrollback_nvim(),
[[acat <<EOF]],
h.with_pause_seconds_before([[acat <<EOF]]),
h.send_as_string([[
line1
line2
Expand Down Expand Up @@ -268,7 +264,7 @@ Press ENTER or type command to continue.*]],
'--config',
'test_pastewin_opts',
}),
h.send_without_newline([[a]]),
h.with_pause_seconds_before(h.send_without_newline([[a]])),
}),
{
stdout = [[
Expand Down Expand Up @@ -301,7 +297,7 @@ $▛▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
'--config',
'test_footer_opts',
}),
h.send_without_newline([[a]]),
h.with_pause_seconds_before(h.send_without_newline([[a]])),
}),
{
stdout = [[
Expand Down Expand Up @@ -334,7 +330,7 @@ $🭽▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
'--config',
'test_pastewin_and_footer_opts',
}),
h.send_without_newline([[a]]),
h.with_pause_seconds_before(h.send_without_newline([[a]])),
}),
{
stdout = [[
Expand Down Expand Up @@ -367,7 +363,7 @@ $▛▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
'--config',
'test_after_paste_window_ready',
}),
[[a]],
h.with_pause_seconds_before([[a]]),
}),
{
stdout = [[
Expand Down Expand Up @@ -397,7 +393,7 @@ $🭽▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
h.assert_screen_equals(
h.feed_kitty({
h.open_kitty_scrollback_nvim(),
h.send_without_newline([[q:i]]),
h.with_pause_seconds_before(h.send_without_newline([[q:i]])),
h.send_without_newline([[# in command-line window]]),
h.send_without_newline(h.esc()),
h.send_without_newline([[V]]),
Expand All @@ -418,7 +414,7 @@ $ # in command-line window
h.assert_screen_match(
h.feed_kitty({
h.open_kitty_scrollback_nvim(),
h.send_without_newline([[a]]),
h.with_pause_seconds_before(h.send_without_newline([[a]])),
h.send_without_newline(h.esc()),
[[:set filetype?]],
}),
Expand Down
12 changes: 6 additions & 6 deletions tests/kitty-scrollback/kitty_scrollback_visual_cmd_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ describe('kitty-scrollback.nvim', function()
h.assert_screen_equals(
h.feed_kitty({
h.open_kitty_scrollback_nvim(),
h.send_without_newline([[aecho start echo stop]]),
h.with_pause_seconds_before(h.send_without_newline([[aecho start echo stop]])),
h.esc(),
h.send_without_newline([[vBB]]),
h.send_without_newline(h.control_enter()),
Expand All @@ -69,7 +69,7 @@ $
h.feed_kitty({
[[echo echo start stop]],
h.open_kitty_scrollback_nvim(),
h.send_without_newline([[kV]]),
h.with_pause_seconds_before(h.send_without_newline([[kV]])),
h.send_without_newline(h.control_enter()),
}),
{
Expand All @@ -91,7 +91,7 @@ $
h.feed_kitty({
[[echo aaecho start stop]],
h.open_kitty_scrollback_nvim(),
h.send_without_newline([[k]]),
h.with_pause_seconds_before(h.send_without_newline([[k]])),
h.send_without_newline(h.control_v()),
h.send_without_newline([[kww]]),
h.send_without_newline(h.control_enter()),
Expand All @@ -116,7 +116,7 @@ $
h.assert_screen_equals(
h.feed_kitty({
h.open_kitty_scrollback_nvim(),
h.send_without_newline([[aecho start echo stop]]),
h.with_pause_seconds_before(h.send_without_newline([[aecho start echo stop]])),
h.esc(),
h.send_without_newline([[vBB]]),
h.send_without_newline(h.shift_enter()),
Expand All @@ -136,7 +136,7 @@ $ echo stop
h.feed_kitty({
[[echo echo start stop]],
h.open_kitty_scrollback_nvim(),
h.send_without_newline([[kV]]),
h.with_pause_seconds_before(h.send_without_newline([[kV]])),
h.send_without_newline(h.shift_enter()),
}),
{
Expand All @@ -156,7 +156,7 @@ $ echo start stop
h.feed_kitty({
[[echo aaecho start stop]],
h.open_kitty_scrollback_nvim(),
h.send_without_newline([[k]]),
h.with_pause_seconds_before(h.send_without_newline([[k]])),
h.send_without_newline(h.control_v()),
h.send_without_newline([[kww]]),
h.send_without_newline(h.shift_enter()),
Expand Down

0 comments on commit d51725a

Please sign in to comment.