hephaestus/heph.nvim/tests/e2e/home_spec.lua
Erich Blume e99c284941
Some checks failed
Build / validate (pull_request) Failing after 5m3s
heph.nvim: :Heph home — a base index/landing page for the zk
A single designated "home" doc (open-or-create by title, configurable via
opts.home, default "Home") — a stable landing page to grow a map of content
around. e2e covers create-on-first-open + idempotent reuse.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
2026-06-02 11:14:12 -07:00

27 lines
853 B
Lua

-- The home / index landing page: open-or-create by title, idempotent.
local h = require("e2e.helpers")
describe("home page", function()
local ctx
before_each(function()
ctx = h.start()
end)
after_each(function()
h.stop(ctx)
end)
it("creates the home page on first open and reuses it after", function()
local n1 = require("heph.home").open("Home")
assert.is_truthy(n1.id)
assert.are.equal("heph://node/" .. n1.id, vim.api.nvim_buf_get_name(0))
assert.are.equal("doc", n1.kind)
-- Reopening returns the SAME doc (open-or-create is idempotent by title).
local n2 = require("heph.home").open("Home")
assert.are.equal(n1.id, n2.id)
-- It's a real, resolvable wiki target, so other notes can [[Home]] into it.
assert.are.equal(n1.id, ctx.q:call("node.resolve", { title = "Home" }).id)
end)
end)