fix(test): clear modules properly
This commit is contained in:
parent
80c7697340
commit
101062cb48
2 changed files with 11 additions and 4 deletions
|
|
@ -31,6 +31,12 @@ describe('Error boundary handling', function()
|
|||
}
|
||||
end,
|
||||
scrape_contest_metadata = function(_, contest_id)
|
||||
if contest_id == 'fail_scrape' then
|
||||
return {
|
||||
success = false,
|
||||
error = 'Network error',
|
||||
}
|
||||
end
|
||||
if contest_id == 'fail_metadata' then
|
||||
return {
|
||||
success = false,
|
||||
|
|
@ -122,14 +128,14 @@ describe('Error boundary handling', function()
|
|||
it('should handle scraping failures without state corruption', function()
|
||||
cp.handle_command({ fargs = { 'codeforces', 'fail_scrape', 'a' } })
|
||||
|
||||
local has_error = false
|
||||
local has_metadata_error = false
|
||||
for _, log_entry in ipairs(logged_messages) do
|
||||
if log_entry.level == vim.log.levels.ERROR then
|
||||
has_error = true
|
||||
if log_entry.msg and log_entry.msg:match('failed to load contest metadata') then
|
||||
has_metadata_error = true
|
||||
break
|
||||
end
|
||||
end
|
||||
assert.is_true(has_error, 'Should log error for failed scraping')
|
||||
assert.is_true(has_metadata_error, 'Should log contest metadata failure')
|
||||
|
||||
local context = cp.get_current_context()
|
||||
assert.equals('codeforces', context.platform)
|
||||
|
|
|
|||
|
|
@ -68,6 +68,7 @@ index 1234567..abcdefg 100644
|
|||
end)
|
||||
|
||||
it('handles valid highlight data without errors', function()
|
||||
vim.api.nvim_buf_set_lines(1, 0, -1, false, { 'hello world test line' })
|
||||
local highlights = {
|
||||
{
|
||||
line = 0,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue