Skip to content

Commit

Permalink
test: add tests for resume picker: select_pos
Browse files Browse the repository at this point in the history
  • Loading branch information
delphinus committed Jan 3, 2025
1 parent 93cde81 commit dae2602
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 0 deletions.
12 changes: 12 additions & 0 deletions lua/tests/automated/pickers/resume_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
-- Just skip on mac, it has flaky CI for some reason
if vim.fn.has "mac" == 1 or require("telescope.utils").iswin then
return
end

local tester = require "telescope.testharness"

describe("builtin.resume", function()
it("should select and open the file", function()
tester.run_file "resume__select_pos"
end)
end)
38 changes: 38 additions & 0 deletions lua/tests/pickers/resume__select_pos.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
local helper = require "telescope.testharness.helpers"
local runner = require "telescope.testharness.runner"

runner.picker("find_files", ".md", {
post_close = {
{ "README.md", helper.get_file },
},
})

runner.picker("resume", "", {
post_close = {
{ "developers.md", helper.get_file },
},
}, { select_pos = 1 })

runner.picker("resume", "", {
post_close = {
{ "CONTRIBUTING.md", helper.get_file },
},
}, { select_pos = 1 })

runner.picker("resume", "", {
post_close = {
{ "developers.md", helper.get_file },
},
}, { select_pos = -1 })

runner.picker("resume", "", {
post_close = {
{ "README.md", helper.get_file },
},
}, { select_pos = -1 })

runner.picker("resume", "", {
post_close = {
{ "CONTRIBUTING.md", helper.get_file },
},
}, { select_pos = 2 })

0 comments on commit dae2602

Please sign in to comment.