fix
This commit is contained in:
parent
4b9d63e4b8
commit
1769ea079a
1 changed files with 25 additions and 10 deletions
|
|
@ -141,22 +141,37 @@ describe('cp.picker', function()
|
||||||
|
|
||||||
it('falls back to scraping when cache miss', function()
|
it('falls back to scraping when cache miss', function()
|
||||||
local cache = require('cp.cache')
|
local cache = require('cp.cache')
|
||||||
|
local utils = require('cp.utils')
|
||||||
|
|
||||||
cache.load = function() end
|
cache.load = function() end
|
||||||
cache.get_contest_data = function(_, _)
|
cache.get_contest_data = function(_, _)
|
||||||
return nil
|
return nil
|
||||||
end
|
end
|
||||||
|
cache.set_contest_data = function() end
|
||||||
|
|
||||||
package.loaded['cp.scraper'] = {
|
utils.setup_python_env = function()
|
||||||
scrape_contest_metadata = function(platform, contest_id, callback)
|
return true
|
||||||
callback({
|
end
|
||||||
success = true,
|
utils.get_plugin_path = function()
|
||||||
problems = {
|
return '/tmp'
|
||||||
{ id = 'x', name = 'Problem X' },
|
end
|
||||||
},
|
|
||||||
})
|
-- Mock vim.system to return success with problems
|
||||||
end,
|
vim.system = function(cmd, opts)
|
||||||
}
|
return {
|
||||||
|
wait = function()
|
||||||
|
return {
|
||||||
|
code = 0,
|
||||||
|
stdout = vim.json.encode({
|
||||||
|
success = true,
|
||||||
|
problems = {
|
||||||
|
{ id = 'x', name = 'Problem X' },
|
||||||
|
},
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
end,
|
||||||
|
}
|
||||||
|
end
|
||||||
|
|
||||||
picker = spec_helper.fresh_require('cp.pickers', { 'cp.pickers.init' })
|
picker = spec_helper.fresh_require('cp.pickers', { 'cp.pickers.init' })
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue