local assert = require("luassert") local scraper = require("scraper").module_doc local get_doc_from_page = scraper.get_doc_from_page describe("Scrap documentation", function() it("should return a valid AST for an empty module", function() local ast , nodes = get_doc_from_page("", "empty") assert.same(ast, { children = { { children = {}, name = "Signal", token = "enum", } }, name = "Empty", token = "module", }) assert.same(nodes, {}) end) it("should produce Signal nodes", function() local ast = get_doc_from_page([[

Signals

๐Ÿ”— widget::layout_changed ยท Inherited from wibox.widget.base
๐Ÿ”— widget::redraw_needed ยท Inherited from wibox.widget.base
]], "signal") assert.same(ast, { children = { { children = { { name = "widget::layout_changed", token = "identifier", }, { name = "widget::redraw_needed", token = "identifier", }, }, name = "Signal", token = "enum", }, }, name = "Signal", token = "module", }) end) end)