fiox
This commit is contained in:
parent
d96d810328
commit
45d439a7b2
1 changed files with 10 additions and 14 deletions
|
|
@ -9,6 +9,7 @@ describe('cp.scrape', function()
|
||||||
before_each(function()
|
before_each(function()
|
||||||
spec_helper.setup()
|
spec_helper.setup()
|
||||||
temp_files = {}
|
temp_files = {}
|
||||||
|
mock_system_calls = {}
|
||||||
|
|
||||||
mock_cache = {
|
mock_cache = {
|
||||||
load = function() end,
|
load = function() end,
|
||||||
|
|
@ -19,7 +20,14 @@ describe('cp.scrape', function()
|
||||||
set_test_cases = function() end,
|
set_test_cases = function() end,
|
||||||
}
|
}
|
||||||
|
|
||||||
mock_system_calls = {}
|
mock_utils = {
|
||||||
|
setup_python_env = function()
|
||||||
|
return true
|
||||||
|
end,
|
||||||
|
get_plugin_path = function()
|
||||||
|
return '/test/plugin/path'
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
|
||||||
vim.system = function(cmd, opts)
|
vim.system = function(cmd, opts)
|
||||||
table.insert(mock_system_calls, { cmd = cmd, opts = opts })
|
table.insert(mock_system_calls, { cmd = cmd, opts = opts })
|
||||||
|
|
@ -46,17 +54,9 @@ describe('cp.scrape', function()
|
||||||
}
|
}
|
||||||
end
|
end
|
||||||
|
|
||||||
mock_utils = {
|
|
||||||
setup_python_env = function()
|
|
||||||
return true
|
|
||||||
end,
|
|
||||||
get_plugin_path = function()
|
|
||||||
return '/test/plugin/path'
|
|
||||||
end,
|
|
||||||
}
|
|
||||||
|
|
||||||
package.loaded['cp.cache'] = mock_cache
|
package.loaded['cp.cache'] = mock_cache
|
||||||
package.loaded['cp.utils'] = mock_utils
|
package.loaded['cp.utils'] = mock_utils
|
||||||
|
package.loaded['cp.scrape'] = nil -- Force reload
|
||||||
scrape = require('cp.scrape')
|
scrape = require('cp.scrape')
|
||||||
|
|
||||||
local original_fn = vim.fn
|
local original_fn = vim.fn
|
||||||
|
|
@ -189,10 +189,6 @@ describe('cp.scrape', function()
|
||||||
return false
|
return false
|
||||||
end
|
end
|
||||||
|
|
||||||
-- Force reload the scrape module to pick up the updated mock
|
|
||||||
package.loaded['cp.scrape'] = nil
|
|
||||||
scrape = require('cp.scrape')
|
|
||||||
|
|
||||||
vim.system = function(cmd)
|
vim.system = function(cmd)
|
||||||
if cmd[1] == 'ping' then
|
if cmd[1] == 'ping' then
|
||||||
return {
|
return {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue