chore: add testing for user commands
This commit is contained in:
parent
cb378a6d8c
commit
264f7897bf
5 changed files with 114 additions and 0 deletions
21
tests/minimal.vim
Normal file
21
tests/minimal.vim
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
set rtp +=.
|
||||
set rtp +=../plenary.nvim/
|
||||
|
||||
|
||||
runtime! plugin/plenary.vim
|
||||
|
||||
|
||||
set noswapfile
|
||||
set nobackup
|
||||
|
||||
filetype indent off
|
||||
set nowritebackup
|
||||
set noautoindent
|
||||
set nocindent
|
||||
set nosmartindent
|
||||
set indentexpr=
|
||||
|
||||
|
||||
lua << EOF
|
||||
require("plenary/busted")
|
||||
EOF
|
||||
42
tests/openingh_spec.lua
Normal file
42
tests/openingh_spec.lua
Normal file
|
|
@ -0,0 +1,42 @@
|
|||
vim.g.test = true
|
||||
|
||||
describe("busted should run", function()
|
||||
it("should start test", function()
|
||||
vim.cmd([[packadd openingh.nvim]])
|
||||
local status = require("plenary.reload").reload_module(".nvim")
|
||||
assert.are.same(status, nil)
|
||||
end)
|
||||
|
||||
it("require('openingh')", function()
|
||||
local status = require("openingh")
|
||||
assert.truthy(status)
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("openingh should set user commands", function()
|
||||
it("should set :OpenInGHRepo", function()
|
||||
local status = vim.fn.exists(":OpenInGHRepo")
|
||||
assert.truthy(status)
|
||||
end)
|
||||
|
||||
it("should set :OpenInGHFile", function()
|
||||
local status = vim.fn.exists(":OpenInGHFile")
|
||||
assert.truthy(status)
|
||||
end)
|
||||
end)
|
||||
|
||||
describe("openingh should open", function()
|
||||
it("repo on :OpenInGHRepo", function()
|
||||
vim.cmd("OpenInGHRepo")
|
||||
local status = vim.g.OPENINGH_RESULT
|
||||
assert.truthy(status)
|
||||
end)
|
||||
|
||||
it("file on :OpenInGHFile", function()
|
||||
vim.cmd("e ./README.md")
|
||||
vim.cmd("OpenInGHFile")
|
||||
|
||||
local status = vim.g.OPENINGH_RESULT
|
||||
assert.truthy(status)
|
||||
end)
|
||||
end)
|
||||
Loading…
Add table
Add a link
Reference in a new issue