fix(test): selene unused vars

This commit is contained in:
Barrett Ruth 2025-09-22 23:04:17 -04:00
parent 1f384b0ba0
commit 7ad64677a5
2 changed files with 8 additions and 11 deletions

View file

@ -2,11 +2,8 @@ describe('cp.async.setup', function()
local setup
local spec_helper = require('spec.spec_helper')
local mock_async, mock_scraper, mock_state
local callback_calls = {}
before_each(function()
spec_helper.setup()
callback_calls = {}
mock_async = {
start_contest_operation = function() end,
@ -184,7 +181,7 @@ describe('cp.async.setup', function()
it('starts background test scraping if not cached', function()
local scraping_started = false
mock_scraper.scrape_problem_async = function(platform, contest_id, problem_id, callback)
mock_scraper.scrape_problem_async = function(_, _, problem_id, callback)
scraping_started = true
callback({ success = true, problem_id = problem_id, test_cases = {} })
end
@ -248,7 +245,7 @@ describe('cp.async.setup', function()
local problems = { { id = 'a' }, { id = 'b' }, { id = 'c' } }
local scraping_calls = {}
mock_scraper.scrape_problem_async = function(platform, contest_id, problem_id, callback)
mock_scraper.scrape_problem_async = function(_, _, problem_id, callback)
scraping_calls[#scraping_calls + 1] = problem_id
callback({ success = true, problem_id = problem_id })
end
@ -270,13 +267,13 @@ describe('cp.async.setup', function()
local problems = { { id = 'a' }, { id = 'b' } }
local scraping_calls = {}
mock_scraper.scrape_problem_async = function(platform, contest_id, problem_id, callback)
mock_scraper.scrape_problem_async = function(_, _, problem_id, callback)
scraping_calls[#scraping_calls + 1] = problem_id
callback({ success = true, problem_id = problem_id })
end
local mock_cache = require('cp.cache')
mock_cache.get_test_cases = function(platform, contest_id, problem_id)
mock_cache.get_test_cases = function(_, _, problem_id)
return problem_id == 'a' and { { input = '1', expected = '1' } } or nil
end

View file

@ -105,7 +105,7 @@ end
function M.mock_async_scraper_success()
package.loaded['cp.async.scraper'] = {
scrape_contest_metadata_async = function(platform, contest_id, callback)
scrape_contest_metadata_async = function(_, _, callback)
vim.schedule(function()
callback({
success = true,
@ -117,7 +117,7 @@ function M.mock_async_scraper_success()
})
end)
end,
scrape_problem_async = function(platform, contest_id, problem_id, callback)
scrape_problem_async = function(_, _, problem_id, callback)
vim.schedule(function()
callback({
success = true,
@ -138,7 +138,7 @@ end
function M.mock_async_scraper_failure()
package.loaded['cp.async.scraper'] = {
scrape_contest_metadata_async = function(platform, contest_id, callback)
scrape_contest_metadata_async = function(_, _, callback)
vim.schedule(function()
callback({
success = false,
@ -146,7 +146,7 @@ function M.mock_async_scraper_failure()
})
end)
end,
scrape_problem_async = function(platform, contest_id, problem_id, callback)
scrape_problem_async = function(_, _, problem_id, callback)
vim.schedule(function()
callback({
success = false,