chore: add testing for user commands

This commit is contained in:
Ali Almohaya 2022-10-30 02:03:40 +03:00
parent cb378a6d8c
commit 264f7897bf
No known key found for this signature in database
GPG key ID: 4B80BC43FC6007E0
5 changed files with 114 additions and 0 deletions

21
tests/minimal.vim Normal file
View 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
View 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)