From 1e041f13b10f99c240381172e4097b8a08785c9e Mon Sep 17 00:00:00 2001 From: Michael Paulson Date: Fri, 1 Dec 2023 13:56:46 -0700 Subject: [PATCH] feat: removed some duplicate tests that are present in the ui. --- lua/harpoon/test/config_spec.lua | 2 +- lua/harpoon/test/harpoon_spec.lua | 105 ------------------------------ 2 files changed, 1 insertion(+), 106 deletions(-) diff --git a/lua/harpoon/test/config_spec.lua b/lua/harpoon/test/config_spec.lua index b0b66d3..d22555a 100644 --- a/lua/harpoon/test/config_spec.lua +++ b/lua/harpoon/test/config_spec.lua @@ -17,7 +17,7 @@ describe("config", function() }) vim.api.nvim_win_set_cursor(0, { 3, 1 }) - local item = config_item.add() + local item = config_item.add(config_item) eq(item, { value = "/tmp/harpoon-test", context = { diff --git a/lua/harpoon/test/harpoon_spec.lua b/lua/harpoon/test/harpoon_spec.lua index af71a03..ffdda18 100644 --- a/lua/harpoon/test/harpoon_spec.lua +++ b/lua/harpoon/test/harpoon_spec.lua @@ -105,109 +105,4 @@ describe("harpoon", function() }) end) - it("ui - display resolve", function() - harpoon:setup({ - default = { - display = function(item) - -- split string on / - local parts = vim.split(item.value, "/") - return parts[#parts] - end, - }, - }) - - local file_names = { - "/tmp/harpoon-test-1", - "/tmp/harpoon-test-2", - "/tmp/harpoon-test-3", - "/tmp/harpoon-test-4", - } - - local contents = { "foo", "bar", "baz", "qux" } - - local bufnrs = {} - local list = harpoon:list() - for _, v in ipairs(file_names) do - table.insert(bufnrs, utils.create_file(v, contents)) - harpoon:list():append() - end - - local displayed = list:display() - eq(displayed, { - "harpoon-test-1", - "harpoon-test-2", - "harpoon-test-3", - "harpoon-test-4", - }) - - table.remove(displayed, 3) - table.remove(displayed, 2) - - list:resolve_displayed(displayed) - - eq(list.items, { - { value = file_names[1], context = { row = 4, col = 2 } }, - { value = file_names[4], context = { row = 4, col = 2 } }, - }) - end) - - it("ui - display resolve", function() - local file_names = { - "/tmp/harpoon-test-1", - "/tmp/harpoon-test-2", - "/tmp/harpoon-test-3", - "/tmp/harpoon-test-4", - } - - local contents = { "foo", "bar", "baz", "qux" } - - local bufnrs = {} - local list = harpoon:list() - for _, v in ipairs(file_names) do - table.insert(bufnrs, utils.create_file(v, contents)) - harpoon:list():append() - end - - local displayed = list:display() - eq(displayed, { - "/tmp/harpoon-test-1", - "/tmp/harpoon-test-2", - "/tmp/harpoon-test-3", - "/tmp/harpoon-test-4", - }) - - table.remove(displayed, 3) - table.remove(displayed, 2) - - table.insert(displayed, "/tmp/harpoon-test-other-file-1") - table.insert(displayed, "/tmp/harpoon-test-other-file-2") - - list:resolve_displayed(displayed) - - eq({ - { value = file_names[1], context = { row = 4, col = 2 } }, - { value = file_names[4], context = { row = 4, col = 2 } }, - { - value = "/tmp/harpoon-test-other-file-1", - context = { row = 1, col = 0 }, - }, - { - value = "/tmp/harpoon-test-other-file-2", - context = { row = 1, col = 0 }, - }, - }, list.items) - - table.remove(displayed, 3) - table.insert(displayed, "/tmp/harpoon-test-4") - list:resolve_displayed(displayed) - - eq({ - { value = file_names[1], context = { row = 4, col = 2 } }, - { value = file_names[4], context = { row = 4, col = 2 } }, - { - value = "/tmp/harpoon-test-other-file-2", - context = { row = 1, col = 0 }, - }, - }, list.items) - end) end)