fix(test): include hl in namespace

This commit is contained in:
Barrett Ruth 2025-09-22 20:17:20 -04:00
parent 847f04d1e8
commit 23310eed53
2 changed files with 12 additions and 8 deletions

View file

@ -122,14 +122,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_scrape_error = false
local has_error = false
for _, log_entry in ipairs(logged_messages) do
if log_entry.msg and log_entry.msg:match('scraping failed') then
has_scrape_error = true
if log_entry.level == vim.log.levels.ERROR then
has_error = true
break
end
end
assert.is_true(has_scrape_error, 'Should log scraping failure')
assert.is_true(has_error, 'Should log error for failed scraping')
local context = cp.get_current_context()
assert.equals('codeforces', context.platform)

View file

@ -61,8 +61,9 @@ index 1234567..abcdefg 100644
describe('apply_highlights', function()
it('handles empty highlights without errors', function()
local namespace = highlight.create_namespace()
assert.has_no_errors(function()
highlight.apply_highlights(1, {}, 100)
highlight.apply_highlights(1, {}, namespace)
end)
end)
@ -75,8 +76,9 @@ index 1234567..abcdefg 100644
highlight_group = 'CpDiffAdded',
},
}
local namespace = highlight.create_namespace()
assert.has_no_errors(function()
highlight.apply_highlights(1, highlights, 100)
highlight.apply_highlights(1, highlights, namespace)
end)
end)
end)
@ -90,12 +92,14 @@ index 1234567..abcdefg 100644
describe('parse_and_apply_diff', function()
it('returns content lines', function()
local result = highlight.parse_and_apply_diff(1, '+first\n+second', 100)
local namespace = highlight.create_namespace()
local result = highlight.parse_and_apply_diff(1, '+first\n+second', namespace)
assert.same({ 'first', 'second' }, result)
end)
it('handles empty diff', function()
local result = highlight.parse_and_apply_diff(1, '', 100)
local namespace = highlight.create_namespace()
local result = highlight.parse_and_apply_diff(1, '', namespace)
assert.same({}, result)
end)
end)