Browse Source

test: avoid asserting vim.fn.delete

kylo252 1 year ago
parent
commit
57bc32cb00
2 changed files with 5 additions and 2 deletions
  1. 1 0
      lua/lvim/lsp/templates.lua
  2. 4 2
      tests/specs/lsp_spec.lua

+ 1 - 0
lua/lvim/lsp/templates.lua

@@ -12,6 +12,7 @@ function M.remove_template_files()
   -- remove any outdated files
   -- remove any outdated files
   for _, file in ipairs(vim.fn.glob(ftplugin_dir .. "/*.lua", 1, 1)) do
   for _, file in ipairs(vim.fn.glob(ftplugin_dir .. "/*.lua", 1, 1)) do
     vim.fn.delete(file)
     vim.fn.delete(file)
+    vim.wait(10)
   end
   end
 end
 end
 
 

+ 4 - 2
tests/specs/lsp_spec.lua

@@ -29,14 +29,16 @@ describe("lsp workflow", function()
 
 
   it("should be able to delete ftplugin templates", function()
   it("should be able to delete ftplugin templates", function()
     if utils.is_directory(lvim.lsp.templates_dir) then
     if utils.is_directory(lvim.lsp.templates_dir) then
-      assert.equal(vim.fn.delete(lvim.lsp.templates_dir, "rf"), 0)
+      vim.fn.delete(lvim.lsp.templates_dir, "rf")
+      vim.wait(100)
     end
     end
     assert.False(utils.is_directory(lvim.lsp.templates_dir))
     assert.False(utils.is_directory(lvim.lsp.templates_dir))
   end)
   end)
 
 
   it("should be able to generate ftplugin templates", function()
   it("should be able to generate ftplugin templates", function()
     if utils.is_directory(lvim.lsp.templates_dir) then
     if utils.is_directory(lvim.lsp.templates_dir) then
-      assert.equal(vim.fn.delete(lvim.lsp.templates_dir, "rf"), 0)
+      vim.fn.delete(lvim.lsp.templates_dir, "rf")
+      vim.wait(100)
     end
     end
 
 
     require("lvim.lsp").setup()
     require("lvim.lsp").setup()