Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F7859874
render.test.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
render.test.ts
View Options
import
{
streamToString
}
from
"tempstream"
;
import
{
JDD
}
from
"./jdd.js"
;
import
{
makeSimpleEnglishJDDContext
}
from
"./index.js"
;
import
{
Registry
}
from
"./registry.js"
;
import
{
Markdown
}
from
"./components/markdown.js"
;
import
{
FileManager
}
from
"@sealcode/file-manager"
;
import
assert
from
"assert"
;
import
{
formatWithPrettier
}
from
"./test-utils/prettier.js"
;
describe
(
"render method"
,
()
=>
{
describe
(
"renderFromStorage"
,
()
=>
{
it
(
"renders from a raw document"
,
async
()
=>
{
const
registry
=
new
Registry
();
registry
.
add
(
"markdown"
,
Markdown
);
const
jdd
=
await
JDD
.
fromStorage
(
registry
,
makeSimpleEnglishJDDContext
(
new
FileManager
(
"/tmp"
,
"/uploaded_files"
)
),
[
{
component_name
:
"markdown"
,
args
:
{
markdown
:
"# Hello"
},
},
]
);
assert
.
strictEqual
(
await
formatWithPrettier
(
await
jdd
.
render
()),
await
formatWithPrettier
(
/* HTML */
`<section
class="jdd-component component-number-0"
>
<h1 id="hello">
<a class="anchor" href="#hello">
<span class="markdown-header-link"></span>
</a>
Hello
</h1>
</section>`
)
);
});
});
});
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Wed, Aug 13, 17:08 (1 d, 2 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
870776
Default Alt Text
render.test.ts (1 KB)
Attached To
Mode
rJDD jdd
Attached
Detach File
Event Timeline
Log In to Comment