From ea595edb951e2f8aac29891f473f011e7ed434f3 Mon Sep 17 00:00:00 2001 From: shortcuts Date: Tue, 3 Sep 2024 21:00:31 +0200 Subject: [PATCH] chore: assertion on neotree --- tests/helpers.lua | 4 +-- tests/test_integrations.lua | 49 +++++++++++++++++++++++++++++++++++++ 2 files changed, 51 insertions(+), 2 deletions(-) diff --git a/tests/helpers.lua b/tests/helpers.lua index e663858..273b325 100644 --- a/tests/helpers.lua +++ b/tests/helpers.lua @@ -89,8 +89,8 @@ Helpers.new_child_neovim = function() error(msg) end - child.wait = function() - child.loop.sleep(10) + child.wait = function(ms) + child.loop.sleep(ms or 10) end child.nnp = function() diff --git a/tests/test_integrations.lua b/tests/test_integrations.lua index cd4e3f7..6677009 100644 --- a/tests/test_integrations.lua +++ b/tests/test_integrations.lua @@ -375,6 +375,55 @@ T["neo-tree"]["keeps sides open"] = function() id = 1004, open = "Neotree reveal", }) + + child.nnp() + child.nnp() + + Helpers.expect.equality(child.get_wins_in_tab(), { 1005, 1004, 1000, 1006 }) + + Helpers.expect.state(child, "tabs[1].wins.main", { + curr = 1000, + left = 1005, + right = 1006, + }) + + Helpers.expect.state(child, "tabs[1].wins.columns", 4) + + Helpers.expect.state(child, "tabs[1].wins.integrations.NeoTree", { + close = "Neotree close", + fileTypePattern = "neo-tree", + id = 1004, + open = "Neotree reveal", + }) +end + + +T["neo-tree"]["properly enables nnp with tree already opened"] = function() + child.restart({ "-u", "scripts/init_with_neotree.lua", "." }) + + Helpers.expect.equality(child.get_wins_in_tab(1), { 1002, 1000 }) + + child.cmd("e Makefile") + + child.nnp() + + Helpers.expect.equality(child.get_wins_in_tab(), { 1004, 1002, 1000, 1005 }) + + Helpers.expect.state(child, "enabled", true) + + Helpers.expect.state(child, "tabs[1].wins.integrations.NeoTree", { + close = "Neotree close", + fileTypePattern = "neo-tree", + id = 1002, + open = "Neotree reveal", + }) + + + Helpers.expect.state(child, "tabs[1].wins.main", { + curr = 1000, + left = 1004, + right = 1005, + }) end T["TSPlayground"] = MiniTest.new_set()