From 2f278c876a146db4e88045fb4b4ffcc4b73beec6 Mon Sep 17 00:00:00 2001 From: s1n7ax Date: Sun, 3 Dec 2023 01:06:47 +0530 Subject: [PATCH] fix(test): adding missing dep for tests --- tests/before-test.lua | 3 --- tests/java-dap/java_dap_spec.lua | 4 +--- tests/prepare-config.lua | 13 +++++++++++++ tests/test-config.lua | 14 ++++++++++++++ 4 files changed, 28 insertions(+), 6 deletions(-) delete mode 100644 tests/before-test.lua create mode 100644 tests/test-config.lua diff --git a/tests/before-test.lua b/tests/before-test.lua deleted file mode 100644 index 8495857..0000000 --- a/tests/before-test.lua +++ /dev/null @@ -1,3 +0,0 @@ -local temp_path = './.test_plugins' - -vim.opt.rtp:append(temp_path .. '/plenary.nvim') diff --git a/tests/java-dap/java_dap_spec.lua b/tests/java-dap/java_dap_spec.lua index d14fae5..29dd3b7 100644 --- a/tests/java-dap/java_dap_spec.lua +++ b/tests/java-dap/java_dap_spec.lua @@ -1,7 +1,5 @@ -local plugin = require('java-dap') - describe('setup', function() it('java-dap', function() - assert('plugin module should be avaiable', plugin) + assert('setup module should be avaiable', require('java-dap.api.setup')) end) end) diff --git a/tests/prepare-config.lua b/tests/prepare-config.lua index 50c1503..c0963fb 100644 --- a/tests/prepare-config.lua +++ b/tests/prepare-config.lua @@ -1,5 +1,12 @@ local lazypath = vim.fn.stdpath('data') .. '/lazy/lazy.nvim' +---@diagnostic disable: assign-type-mismatch +---@param path string +---@return string|nil +local function local_plug(path) + return vim.fn.isdirectory(path) == 1 and path or nil +end + if not vim.loop.fs_stat(lazypath) then vim.fn.system({ 'git', @@ -20,6 +27,12 @@ require('lazy').setup({ 'nvim-lua/plenary.nvim', lazy = false, }, + { + 'nvim-java/nvim-java-core', + ---@diagnostic disable-next-line: assign-type-mismatch + dir = local_plug('~/Workspace/nvim-java-core'), + lazy = false, + }, }, { root = temp_path, lockfile = temp_path .. '/lazy-lock.json', diff --git a/tests/test-config.lua b/tests/test-config.lua new file mode 100644 index 0000000..3fa1685 --- /dev/null +++ b/tests/test-config.lua @@ -0,0 +1,14 @@ +---@diagnostic disable: assign-type-mismatch +---@param dev_path string +---@param plug_path string +---@return string|nil +local function local_plug(dev_path, plug_path) + return (vim.fn.isdirectory(dev_path) == 1) and dev_path or plug_path +end + +local plug_path = './.test_plugins' + +vim.opt.rtp:append(plug_path .. '/plenary.nvim') +vim.opt.rtp:append( + local_plug('~/Workspace/nvim-java-core', plug_path .. '/nvim-java-core') +)