// Asserting + eyeball check of the SHIPPED bundle (dist/index.cjs), not src/. // vitest imports src/ only, so this is the one place that exercises the tsup // output — it pins the CJS footer unwrap (new (require(...))() keeps working) // and that the built bundle actually parses the fixture. const assert = require("node:assert/strict"); const testObject = require("./testData.json"); const edjsParser = require("../dist/index.cjs"); // the tsup CJS footer must unwrap { default: Class } → the class itself, // so the historical `new (require("editorjs-parser"))()` keeps working assert.equal(typeof edjsParser, "function"); const parser = new edjsParser({ embed: { useProvidedLength: false }, quote: { applyAlignment: true }, }, {}, { youtube: '<%data.embed%><%data.length%>', }); const html = parser.parse(testObject); assert.ok(html.includes(""), "custom embeds resolve"); assert.ok(html.includes('

"), "table renders"); // 3.2.0 features present in the shipped artifact, not just in src/ assert.ok( parser.parseBlock({ type: "alert", data: { type: "info", message: "m" } }).includes("cdx-alert"), "alert parser ships" ); assert.equal( parser.parseBlock({ type: "paragraph", data: { text: "x" }, tunes: { t: { alignment: "center" } } }), '

x

', "alignment tune ships" ); assert.equal( parser.parseBlock({ type: "list", data: { style: "ordered", meta: { start: 3, counterType: "lower-roman" }, items: [{ content: "third", meta: {}, items: [] }, { content: "fourth", meta: {}, items: [] }], } }), '
  1. third
  2. fourth
', "ordered list block metadata ships" ); console.log("smoke: all bundle assertions passed\n\nHTML:\n" + html);