Skip to content

Commit

Permalink
test: update checkhealth test assertion
Browse files Browse the repository at this point in the history
  • Loading branch information
mikesmithgh committed Sep 28, 2024
1 parent 3f430ff commit 93d13f7
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 42 deletions.
40 changes: 22 additions & 18 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,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()
Expand Down
46 changes: 22 additions & 24 deletions tests/kitty-scrollback/kitty_scrollback_spec.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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,
Expand All @@ -151,25 +151,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 +202,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 +266,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 +299,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 +332,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 +365,7 @@ $▛▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀▀
'--config',
'test_after_paste_window_ready',
}),
[[a]],
h.with_pause_seconds_before([[a]]),
}),
{
stdout = [[
Expand Down Expand Up @@ -397,7 +395,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 +416,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

0 comments on commit 93d13f7

Please sign in to comment.