fix: fix flacky test (#434)

This commit is contained in:
Shadman 2021-11-13 20:01:01 +06:00 committed by GitHub
parent d2f5d6c8aa
commit 46534fe8b7
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 9 additions and 0 deletions

View File

@ -8,5 +8,6 @@ end
vim.cmd [[
set rtp+=.
set rtp+=../plenary.nvim
set rtp+=../nvim-web-devicons/
runtime plugin/plenary.vim
]]

View File

@ -258,11 +258,19 @@ describe('Filetype component', function()
end)
it('does not add icon when library unavailable', function()
local old_require = _G.require
function _G.require(...)
if select(1, ...) == 'nvim-web-devicons' then
error("Test case not suppose to have web-dev-icon 👀")
end
return old_require(...)
end
local opts = build_component_opts {
component_separators = { left = '', right = '' },
padding = 0,
}
assert_component('filetype', opts, 'lua')
_G.require = old_require
end)
it('colors nvim-web-devicons icons', function()