Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F22420748
markdown.test.ts
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Authored By
Unknown
Size
1 KB
Referenced Files
None
Subscribers
None
markdown.test.ts
View Options
import
{
Registry
}
from
"../registry.js"
;
import
{
Markdown
}
from
"./markdown.js"
;
import
{
documentContainerFromParsed
,
makeSimpleEnglishJDDContext
,
render
,
}
from
"../index.js"
;
import
assert
from
"assert"
;
import
{
streamToString
}
from
"tempstream"
;
import
{
FileManager
}
from
"@sealcode/file-manager"
;
import
{
formatWithPrettier
}
from
"../test-utils/prettier.js"
;
describe
(
"markdown component"
,
()
=>
{
it
(
"renders as a part of a JDD"
,
async
()
=>
{
const
document
=
documentContainerFromParsed
([
{
component_name
:
"markdown"
,
args
:
{
markdown
:
`# Hello World`
}
},
{
component_name
:
"markdown"
,
args
:
{
markdown
:
`Multiple components ftw`
},
},
]);
const
registry
=
new
Registry
();
registry
.
add
(
"markdown"
,
Markdown
);
const
result
=
await
streamToString
(
render
(
registry
,
document
,
makeSimpleEnglishJDDContext
(
new
FileManager
(
"/tmp"
,
"/uploaded_files"
)
)
)
);
assert
.
strictEqual
(
formatWithPrettier
(
result
,
"html"
),
// note the soft hyphens
formatWithPrettier
(
/* HTML */
`<section class="jdd-component component-number-0">
<h1>Hello World</h1>
</section>
<section class="jdd-component component-number-1">
<p>Multiple components ftw</p>
</section>`
,
"html"
)
);
});
});
File Metadata
Details
Attached
Mime Type
application/javascript
Expires
Sat, Nov 28, 02:53 (3 h, 29 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
1230103
Default Alt Text
markdown.test.ts (1 KB)
Attached To
Mode
rJDD jdd
Attached
Detach File
Event Timeline