test: added tests for mini.icons

This commit is contained in:
Folke Lemaitre
2024-07-07 17:46:29 +02:00
parent 33e1da585d
commit 09831414cf
2 changed files with 25 additions and 0 deletions

View File

@ -1,5 +1,7 @@
---@module 'luassert'
local Icons = require("mini.icons")
local Plugin = require("lazy.core.plugin")
_G.LazyVim = require("lazyvim.util")
@ -98,6 +100,28 @@ describe("Extra", function()
)
end)
end
-- Icons
local icons = spec.plugins["mini.icons"]
if icons then
local icon_opts = Plugin.values(icons, "opts", false) or {}
local cats = { "directory", "file", "extension", "filetype", "lsp", "os" }
for _, cat in ipairs(cats) do
local cat_names = Icons.list(cat)
if icon_opts[cat] then
describe("does not set existing icons for " .. cat, function()
for icon_name in pairs(icon_opts[cat]) do
it(icon_name, function()
assert.is_false(
vim.tbl_contains(cat_names, icon_name),
"Icon " .. icon_name .. " already exists:\n" .. vim.inspect({ Icons.get(cat, icon_name) })
)
end)
end
end)
end
end
end
end)
end
end)

View File

@ -11,5 +11,6 @@ require("lazy.minit").setup({
"williamboman/mason-lspconfig.nvim",
"williamboman/mason.nvim",
"nvim-treesitter/nvim-treesitter",
{ "echasnovski/mini.icons", opts = {} },
},
})