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 1

section 1

" + "

title 2

section 2

" + "

title 3

section 3

" + "

title 4

section 4

" ); assert( ` + 1 + 2 - 3 - 4 + 5 `, "
" ); assert( "@@html:@@delete this@@html:@@", "

delete this

" ); assert( ` * title paragraph 1 paragraph 2 paragraph 3 paragraph 4 `, "

title

" + "

paragraph 1

paragraph 2

" + "

paragraph 3

paragraph 4

" + "
" ); });