Page Menu
Home
Sealhub
Search
Configure Global Search
Log In
Files
F4637633
markdown.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
markdown.test.ts
View Options
import
assert
from
"assert"
;
import
{
Collection
,
SuperContext
}
from
"../../../main.js"
;
import
{
TestApp
}
from
"../../../test_utils/test-app.js"
;
import
{
withRunningApp
}
from
"../../../test_utils/with-test-app.js"
;
import
Markdown
from
"./markdown.js"
;
const
testFormating
=
(
input
:
string
,
format
:
"html"
|
"markdown"
,
expected_value
:
string
)
=>
withRunningApp
(
(
test_app_type
)
=>
{
return
class
extends
test_app_type
{
collections
=
{
...
TestApp
.
BaseCollections
,
post
:
new
(
class
extends
Collection
{
fields
=
{
content
:
new
Markdown
(),
};
})(),
};
};
},
async
({
app
})
=>
{
const
context
=
new
SuperContext
(
app
);
const
response
=
await
app
.
collections
.
post
.
create
(
context
,
{
content
:
input
,
});
const
{
items
:
[
item
],
}
=
await
app
.
collections
.
post
.
list
(
context
)
.
ids
([
response
.
id
])
.
format
({
content
:
format
})
.
fetch
();
assert
.
strictEqual
(
item
.
get
(
"content"
),
expected_value
);
}
);
describe
(
"markdown"
,
()
=>
{
it
(
"should map markdown to html"
,
()
=>
{
return
testFormating
(
"# This is markdown file"
,
"html"
,
"<h1>This is markdown file</h1>\n"
);
});
it
(
"should return source markdown text"
,
()
=>
{
return
testFormating
(
"# This is markdown file"
,
"markdown"
,
"# This is markdown file"
);
});
});
File Metadata
Details
Attached
Mime Type
text/x-java
Expires
Tue, May 27, 23:49 (1 d, 20 h)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
631747
Default Alt Text
markdown.test.ts (1 KB)
Attached To
Mode
rS Sealious
Attached
Detach File
Event Timeline
Log In to Comment