From 683ce58652f43cc077004dc0158da7d1fde783a0 Mon Sep 17 00:00:00 2001 From: Ade Attwood Date: Sun, 4 Sep 2022 14:01:02 +0100 Subject: [PATCH] test: add base test for ivy.window --- lua/ivy/window_test.lua | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 lua/ivy/window_test.lua diff --git a/lua/ivy/window_test.lua b/lua/ivy/window_test.lua new file mode 100644 index 0000000..fff5bc4 --- /dev/null +++ b/lua/ivy/window_test.lua @@ -0,0 +1,30 @@ +local window = require "ivy.window" + +before_each(function() + -- Mock the global vim functions we are using in the prompt + _G.vim = { + notify = function() end, + api = { + nvim_echo = function() end, + nvim_get_current_win = function() + return 10 + end, + nvim_command = function() end, + nvim_win_get_buf = function() + return 10 + end, + nvim_win_set_option = function() end, + nvim_buf_set_option = function() end, + nvim_buf_set_var = function() end, + nvim_buf_set_keymap = function() end, + }, + } +end) + +it("can initialize", function(t) + window.initialize() + + if window.get_buffer() ~= 10 then + t.error("The windows buffer should be 10 found " .. window.get_buffer()) + end +end)