const { readFile } = require("fs/promises"); const { resolve } = require("path"); const { strictEqual } = require("assert"); const { init, renderHtml } = require("../lib/orgize.umd"); const assert = (org, html) => strictEqual(renderHtml(org), html); readFile(resolve(__dirname, "../lib/orgize_bg.wasm")) .then((bytes) => new WebAssembly.Module(bytes)) .then((module) => init(module)) .then(() => { assert( "*bold*, /italic/,\n_underlined_, =verbatim= and ~code~", "bold, italic,\nunderlined, " + "verbatim and code" ); assert( "Visit[[http://example.com][link1]]or[[http://example.com][link1]].", `Visitlink1orlink1.` ); assert( ` * title 1 section 1 ** title 2 section 2 * title 3 section 3 * title 4 section 4 `, "title 1section 1" + "title 2section 2" + "title 3section 3" + "title 4section 4" ); assert( ` + 1 + 2 - 3 - 4 + 5 `, "" + "1" + "234" + "5" + "" ); assert( "@@html:@@delete this@@html:@@", "delete this" ); assert( ` * title paragraph 1 paragraph 2 paragraph 3 paragraph 4 `, "title" + "paragraph 1paragraph 2" + "paragraph 3paragraph 4" + "" ); });
bold, italic,\nunderlined, " + "verbatim and code
verbatim
code
Visitlink1orlink1.
section 1
section 2
section 3
section 4
1
2
3
4
5
delete this
paragraph 1
paragraph 2
paragraph 3
paragraph 4