Skip to content

Commit

Permalink
test: add colorscheme tests file
Browse files Browse the repository at this point in the history
  • Loading branch information
barrientosvctor committed May 13, 2024
1 parent b19c2a6 commit ab01623
Show file tree
Hide file tree
Showing 2 changed files with 61 additions and 0 deletions.
58 changes: 58 additions & 0 deletions test/abyss/theme_spec.lua
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
local abyss = require("abyss")
local config = require("abyss.config")

describe("Abyss.nvim", function ()
before_each(function ()
vim.cmd.colorscheme "abyss"
end)

it("works with default setup", function ()
abyss.setup()
assert.are.same(config.default_options, config.options)
end)

it("has correct colors_name", function ()
assert.are.same("abyss", vim.g.colors_name)
end)

it("should change the config", function ()
local expected = {
italic_comments = false,
italic = false,
bold = true,
transparent_background = true,
treesitter = not vim.fn.has("nvim") ~= 1,
overrides = nil,
}

abyss.setup({ italic_comments = false, bold = true, transparent_background = true })
assert.are.same(expected, config.options)
end)

it("has nil overrides", function ()
abyss.setup()
assert.are.are_nil(config.options.overrides, "Overrides property should be a nil value.")
end)

it("has overrides", function ()
abyss.setup({
overrides = {
String = { fg = "#fffa0c" }
}
})

assert.are.not_nil(config.options.overrides, "Overrides property must not be a nil value.")
end)

describe("Treesitter option", function ()
it("should check if vim or neovim is running", function ()
abyss.setup()
local is_vim = vim.fn.has("nvim") ~= 1
if is_vim then
assert.are.equals(is_vim, config.options.treesitter, "Treesitter must be disabled for Vim.")
else
assert.are.equals(not is_vim, config.options.treesitter, "Treesitter must be enabled for Neovim.")
end
end)
end)
end)
3 changes: 3 additions & 0 deletions test/minimal_init.vim
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
set rtp+=.
set rtp+=./test/plenary
runtime! plugin/plenary.vim

0 comments on commit ab01623

Please sign in to comment.