fix(test): selene unused vars
This commit is contained in:
parent
1f384b0ba0
commit
7ad64677a5
2 changed files with 8 additions and 11 deletions
|
|
@ -2,11 +2,8 @@ describe('cp.async.setup', function()
|
||||||
local setup
|
local setup
|
||||||
local spec_helper = require('spec.spec_helper')
|
local spec_helper = require('spec.spec_helper')
|
||||||
local mock_async, mock_scraper, mock_state
|
local mock_async, mock_scraper, mock_state
|
||||||
local callback_calls = {}
|
|
||||||
|
|
||||||
before_each(function()
|
before_each(function()
|
||||||
spec_helper.setup()
|
spec_helper.setup()
|
||||||
callback_calls = {}
|
|
||||||
|
|
||||||
mock_async = {
|
mock_async = {
|
||||||
start_contest_operation = function() end,
|
start_contest_operation = function() end,
|
||||||
|
|
@ -184,7 +181,7 @@ describe('cp.async.setup', function()
|
||||||
|
|
||||||
it('starts background test scraping if not cached', function()
|
it('starts background test scraping if not cached', function()
|
||||||
local scraping_started = false
|
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
|
scraping_started = true
|
||||||
callback({ success = true, problem_id = problem_id, test_cases = {} })
|
callback({ success = true, problem_id = problem_id, test_cases = {} })
|
||||||
end
|
end
|
||||||
|
|
@ -248,7 +245,7 @@ describe('cp.async.setup', function()
|
||||||
local problems = { { id = 'a' }, { id = 'b' }, { id = 'c' } }
|
local problems = { { id = 'a' }, { id = 'b' }, { id = 'c' } }
|
||||||
local scraping_calls = {}
|
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
|
scraping_calls[#scraping_calls + 1] = problem_id
|
||||||
callback({ success = true, problem_id = problem_id })
|
callback({ success = true, problem_id = problem_id })
|
||||||
end
|
end
|
||||||
|
|
@ -270,13 +267,13 @@ describe('cp.async.setup', function()
|
||||||
local problems = { { id = 'a' }, { id = 'b' } }
|
local problems = { { id = 'a' }, { id = 'b' } }
|
||||||
local scraping_calls = {}
|
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
|
scraping_calls[#scraping_calls + 1] = problem_id
|
||||||
callback({ success = true, problem_id = problem_id })
|
callback({ success = true, problem_id = problem_id })
|
||||||
end
|
end
|
||||||
|
|
||||||
local mock_cache = require('cp.cache')
|
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
|
return problem_id == 'a' and { { input = '1', expected = '1' } } or nil
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -105,7 +105,7 @@ end
|
||||||
|
|
||||||
function M.mock_async_scraper_success()
|
function M.mock_async_scraper_success()
|
||||||
package.loaded['cp.async.scraper'] = {
|
package.loaded['cp.async.scraper'] = {
|
||||||
scrape_contest_metadata_async = function(platform, contest_id, callback)
|
scrape_contest_metadata_async = function(_, _, callback)
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
callback({
|
callback({
|
||||||
success = true,
|
success = true,
|
||||||
|
|
@ -117,7 +117,7 @@ function M.mock_async_scraper_success()
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
scrape_problem_async = function(platform, contest_id, problem_id, callback)
|
scrape_problem_async = function(_, _, problem_id, callback)
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
callback({
|
callback({
|
||||||
success = true,
|
success = true,
|
||||||
|
|
@ -138,7 +138,7 @@ end
|
||||||
|
|
||||||
function M.mock_async_scraper_failure()
|
function M.mock_async_scraper_failure()
|
||||||
package.loaded['cp.async.scraper'] = {
|
package.loaded['cp.async.scraper'] = {
|
||||||
scrape_contest_metadata_async = function(platform, contest_id, callback)
|
scrape_contest_metadata_async = function(_, _, callback)
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
callback({
|
callback({
|
||||||
success = false,
|
success = false,
|
||||||
|
|
@ -146,7 +146,7 @@ function M.mock_async_scraper_failure()
|
||||||
})
|
})
|
||||||
end)
|
end)
|
||||||
end,
|
end,
|
||||||
scrape_problem_async = function(platform, contest_id, problem_id, callback)
|
scrape_problem_async = function(_, _, problem_id, callback)
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
callback({
|
callback({
|
||||||
success = false,
|
success = false,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue