fix(test): mock

This commit is contained in:
Barrett Ruth 2025-09-22 23:11:15 -04:00
parent 76cb1e456e
commit a84b1697bf
4 changed files with 52 additions and 3 deletions

View file

@ -4,6 +4,19 @@ describe('cp.cache', function()
before_each(function()
spec_helper.setup()
local mock_file_content = '{}'
vim.fn.filereadable = function()
return 1
end
vim.fn.readfile = function()
return { mock_file_content }
end
vim.fn.writefile = function(lines)
mock_file_content = table.concat(lines, '\n')
end
vim.fn.mkdir = function() end
cache = require('cp.cache')
cache.load()
end)