generated from eblume/project-template
A `.stylua.toml` (Spaces/2, else stylua defaults) + a `stylua-system` prek hook make Lua whitespace formatter-enforced (the repo had no Lua formatter, so style was hand-maintained and drifted). Normalized the three non-conformant files in passing. 21 nvim e2e specs still green. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
54 lines
2 KiB
Lua
54 lines
2 KiB
Lua
-- Workflow (a): capture a task -> it appears in :Heph next -> open its canonical
|
|
-- context -> add a checklist item -> check it -> mark the task done.
|
|
|
|
local h = require("e2e.helpers")
|
|
|
|
describe("task capture to done", function()
|
|
local ctx
|
|
before_each(function()
|
|
ctx = h.start()
|
|
end)
|
|
after_each(function()
|
|
h.stop(ctx)
|
|
end)
|
|
|
|
it("captures, surfaces in next, edits the context checklist, and marks done", function()
|
|
local task = require("heph.task").capture("Fix roof", { attention = "orange" })
|
|
assert.is_truthy(task.node_id)
|
|
|
|
-- Surfaces in the Tactical view.
|
|
local ranked = require("heph.view").next()
|
|
local viewbuf = vim.api.nvim_get_current_buf()
|
|
local present = false
|
|
for _, l in ipairs(vim.api.nvim_buf_get_lines(viewbuf, 0, -1, false)) do
|
|
if l:find("Fix roof", 1, true) then
|
|
present = true
|
|
end
|
|
end
|
|
assert.is_true(present, "task missing from :Heph next")
|
|
assert.are.equal(task.node_id, ranked[1].node_id)
|
|
assert.is_truthy(ranked[1].canonical_context_id)
|
|
|
|
-- Jump to its canonical context from the view (line 1 is the hint header,
|
|
-- task rows start at line 2).
|
|
vim.api.nvim_win_set_cursor(0, { 2, 0 })
|
|
require("heph.view").open_under_cursor()
|
|
local ctxbuf = vim.api.nvim_get_current_buf()
|
|
assert.are.equal("heph://node/" .. ranked[1].canonical_context_id, vim.api.nvim_buf_get_name(ctxbuf))
|
|
|
|
-- Add a checklist item and save.
|
|
vim.api.nvim_buf_set_lines(ctxbuf, 0, -1, false, { "- [ ] buy shingles" })
|
|
h.save(ctxbuf)
|
|
local stored = ctx.q:call("node.get", { id = ranked[1].canonical_context_id })
|
|
assert.are.equal("- [ ] buy shingles", stored.body)
|
|
|
|
-- Check it off and save.
|
|
vim.api.nvim_buf_set_lines(ctxbuf, 0, -1, false, { "- [x] buy shingles" })
|
|
h.save(ctxbuf)
|
|
|
|
-- Mark the task done from its context buffer (resolves the owning task).
|
|
local done_id = require("heph.task").set_state_current("done")
|
|
assert.are.equal(task.node_id, done_id)
|
|
assert.are.equal("done", ctx.q:call("task.get", { id = task.node_id }).state)
|
|
end)
|
|
end)
|