Feat: Add Basic Lua Test Suite (#115)

This MR adds a Lua test suite to the project, run via busted, and introduces tests for a number of the utility functions. Subsequent work will have to be done to test functions that use the `vim.api` scope and external packages to the plugin.
This commit is contained in:
Harrison (Harry) Cramer
2023-11-20 18:03:35 -05:00
committed by GitHub
parent 1abc33d149
commit 88b9196a2e
12 changed files with 401 additions and 180 deletions

View File

@@ -892,7 +892,7 @@ end
---@param note Note
---@return string
M.build_note_header = function(note)
return "@" .. note.author.username .. " " .. u.format_date(note.created_at)
return "@" .. note.author.username .. " " .. u.time_since(note.created_at)
end
M.build_note_body = function(note, resolve_info)
@@ -977,7 +977,7 @@ M.add_discussions_to_table = function(items)
end
-- Creates the first node in the discussion, and attaches children
local body = u.join_tables(root_text_nodes, discussion_children)
local body = u.spread(root_text_nodes, discussion_children)
local root_node = NuiTree.Node({
text = root_text,
is_note = true,

View File

@@ -46,7 +46,7 @@ M.open = function()
u.switch_can_edit_buf(bufnr, true)
table.insert(lines, string.format("Status: %s (%s)", state.settings.pipeline[pipeline.status], pipeline.status))
table.insert(lines, "")
table.insert(lines, string.format("Last Run: %s", u.format_date(pipeline.created_at)))
table.insert(lines, string.format("Last Run: %s", u.time_since(pipeline.created_at)))
table.insert(lines, string.format("Url: %s", pipeline.web_url))
table.insert(lines, string.format("Triggered By: %s", pipeline.source))
@@ -99,7 +99,7 @@ M.see_logs = function()
local bufnr = vim.api.nvim_get_current_buf()
local linnr = vim.api.nvim_win_get_cursor(0)[1]
local text = u.get_line_content(bufnr, linnr)
local last_word = u.get_last_chunk(text)
local last_word = u.get_last_word(text)
if last_word == nil then
u.notify("Cannot find job name", vim.log.levels.ERROR)
return