summaryrefslogtreecommitdiff
path: root/tests/bootstrap_spec.lua
blob: 73e0a6734d5f92fa714f2209a817c1e5e525b45a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
local a = require "plenary.async_lib.tests"

a.describe("initial start", function()
  local uv = vim.loop
  local home_dir = uv.os_homedir()
  local lvim_config_path = get_config_dir() or home_dir .. "/.config/lvim"
  local lvim_runtime_path = get_runtime_dir() or home_dir .. "/.local/share/lunarvim"

  a.it("shoud be able to detect test environment", function()
    assert.truthy(os.getenv "LVIM_TEST_ENV")
    assert.falsy(package.loaded["impatient"])
  end)

  a.it("should not be reading default neovim directories in the home directoies", function()
    local rtp_list = vim.opt.rtp:get()
    assert.falsy(vim.tbl_contains(rtp_list, vim.fn.stdpath "config"))
  end)

  a.it("should be able to read lunarvim directories", function()
    local rtp_list = vim.opt.rtp:get()
    assert.truthy(vim.tbl_contains(rtp_list, lvim_runtime_path .. "/lvim"))
    assert.truthy(vim.tbl_contains(rtp_list, lvim_config_path))
  end)

  a.it("should be able to run treesitter without errors", function()
    assert.truthy(vim.treesitter.highlighter.active)
  end)

  a.it("should be able to load default packages without errors", function()
    -- TODO: maybe there's a way to avoid hard-coding the names of the modules?
    local startup_plugins = {
      "packer",
      "lspconfig",
      "nlspsettings",
      "null-ls",
    }
    for _, plugin in pairs(startup_plugins) do
      assert.truthy(package.loaded[tostring(plugin)])
    end
  end)
end)