fix(test): include necessary variables
This commit is contained in:
parent
be143d408b
commit
9d92021fcf
2 changed files with 13 additions and 6 deletions
|
|
@ -47,6 +47,13 @@ local function get_contests_for_platform(platform)
|
||||||
return contests
|
return contests
|
||||||
end
|
end
|
||||||
|
|
||||||
|
local constants = require('cp.constants')
|
||||||
|
local platform_display_name = constants.PLATFORM_DISPLAY_NAMES[platform] or platform
|
||||||
|
logger.log(
|
||||||
|
('Scraping %s for contests, this may take a few seconds...'):format(platform_display_name),
|
||||||
|
vim.log.levels.INFO
|
||||||
|
)
|
||||||
|
|
||||||
local plugin_path = utils.get_plugin_path()
|
local plugin_path = utils.get_plugin_path()
|
||||||
local cmd = {
|
local cmd = {
|
||||||
'uv',
|
'uv',
|
||||||
|
|
|
||||||
|
|
@ -129,7 +129,7 @@ describe('cp.scrape', function()
|
||||||
|
|
||||||
describe('system dependency checks', function()
|
describe('system dependency checks', function()
|
||||||
it('handles missing uv executable', function()
|
it('handles missing uv executable', function()
|
||||||
vim.fn.executable = function(_)
|
vim.fn.executable = function(cmd)
|
||||||
return cmd == 'uv' and 0 or 1
|
return cmd == 'uv' and 0 or 1
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
@ -140,7 +140,7 @@ describe('cp.scrape', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles python environment setup failure', function()
|
it('handles python environment setup failure', function()
|
||||||
vim.system = function(_)
|
vim.system = function(cmd)
|
||||||
if cmd[1] == 'ping' then
|
if cmd[1] == 'ping' then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
@ -172,7 +172,7 @@ describe('cp.scrape', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles network connectivity issues', function()
|
it('handles network connectivity issues', function()
|
||||||
vim.system = function(_)
|
vim.system = function(cmd)
|
||||||
if cmd[1] == 'ping' then
|
if cmd[1] == 'ping' then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
@ -231,7 +231,7 @@ describe('cp.scrape', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles subprocess execution failure', function()
|
it('handles subprocess execution failure', function()
|
||||||
vim.system = function(_)
|
vim.system = function(cmd)
|
||||||
if cmd[1] == 'ping' then
|
if cmd[1] == 'ping' then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
@ -262,7 +262,7 @@ describe('cp.scrape', function()
|
||||||
|
|
||||||
describe('json parsing', function()
|
describe('json parsing', function()
|
||||||
it('handles invalid json output', function()
|
it('handles invalid json output', function()
|
||||||
vim.system = function(_)
|
vim.system = function(cmd)
|
||||||
if cmd[1] == 'ping' then
|
if cmd[1] == 'ping' then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
@ -290,7 +290,7 @@ describe('cp.scrape', function()
|
||||||
end)
|
end)
|
||||||
|
|
||||||
it('handles scraper-reported failures', function()
|
it('handles scraper-reported failures', function()
|
||||||
vim.system = function(_)
|
vim.system = function(cmd)
|
||||||
if cmd[1] == 'ping' then
|
if cmd[1] == 'ping' then
|
||||||
return {
|
return {
|
||||||
wait = function()
|
wait = function()
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue