-- Workflow (d): link two documents — type [[B]] in A, save, assert the -- backlink B<-A was materialized by the daemon's extraction. local h = require("e2e.helpers") describe("link two docs", function() local ctx before_each(function() ctx = h.start() end) after_each(function() h.stop(ctx) end) it("typing [[B]] in A and saving creates a wiki backlink B<-A", function() local b = h.create_doc("B", "the B doc") local a = h.create_doc("A", "") local buf = h.open(a.id) h.set_lines(buf, { "see [[B]]" }) h.save(buf) local backlinks = ctx.q:call("links.backlinks", { id = b.id }) local found = false for _, l in ipairs(backlinks) do if l.src_id == a.id and l.link_type == "wiki" then found = true end end assert.is_true(found, "expected a wiki backlink from A to B") end) end)