Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
S
sfm-js
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Requirements
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
dakkar
sfm-js
Commits
ffe1e3ff
Commit
ffe1e3ff
authored
3 years ago
by
marihachi
Browse files
Options
Downloads
Patches
Plain Diff
add test
parent
3de0ffdf
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/api.ts
+117
-0
117 additions, 0 deletions
test/api.ts
with
117 additions
and
0 deletions
test/api.ts
+
117
−
0
View file @
ffe1e3ff
...
...
@@ -20,6 +20,123 @@ after`;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
input
);
});
it
(
'
single node
'
,
()
=>
{
const
input
=
'
$[tada Hello]
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)[
0
]),
'
$[tada Hello]
'
);
});
it
(
'
quote
'
,
()
=>
{
const
input
=
`
> abc
>
> 123
`
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
'
> abc
\n
>
\n
> 123
'
);
});
it
(
'
search
'
,
()
=>
{
const
input
=
'
MFM 書き方 123 Search
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
'
MFM 書き方 123 Search
'
);
});
it
(
'
center
'
,
()
=>
{
const
input
=
'
<center>
\n
abc
\n
</center>
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
input
);
});
// it('center (single line)', () => {
// const input = '<center>abc</center>';
// assert.strictEqual(mfm.toString(mfm.parse(input)), input);
// });
it
(
'
emoji code
'
,
()
=>
{
const
input
=
'
:abc:
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
input
);
});
it
(
'
unicode emoji
'
,
()
=>
{
const
input
=
'
今起きた😇
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
input
);
});
it
(
'
big
'
,
()
=>
{
const
input
=
'
***abc***
'
;
const
output
=
'
$[tada abc]
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
output
);
});
it
(
'
bold
'
,
()
=>
{
const
input
=
'
**abc**
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
input
);
});
// it('bold tag', () => {
// const input = '<b>abc</b>';
// assert.strictEqual(mfm.toString(mfm.parse(input)), input);
// });
it
(
'
small
'
,
()
=>
{
const
input
=
'
<small>abc</small>
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
input
);
});
// it('italic', () => {
// const input = '*abc*';
// assert.strictEqual(mfm.toString(mfm.parse(input)), input);
// });
it
(
'
italic tag
'
,
()
=>
{
const
input
=
'
<i>abc</i>
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
input
);
});
it
(
'
strike
'
,
()
=>
{
const
input
=
'
~~foo~~
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
input
);
});
// it('strike tag', () => {
// const input = '<s>foo</s>';
// assert.strictEqual(mfm.toString(mfm.parse(input)), input);
// });
it
(
'
inline code
'
,
()
=>
{
const
input
=
'
AiScript: `#abc = 2`
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
'
AiScript: `#abc = 2`
'
);
});
it
(
'
math inline
'
,
()
=>
{
const
input
=
'
\\
(y = 2x + 3
\\
)
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
'
\\
(y = 2x + 3
\\
)
'
);
});
it
(
'
hashtag
'
,
()
=>
{
const
input
=
'
a #misskey b
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
'
a #misskey b
'
);
});
it
(
'
link
'
,
()
=>
{
const
input
=
'
[Ai](https://github.com/syuilo/ai)
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
'
[Ai](https://github.com/syuilo/ai)
'
);
});
it
(
'
silent link
'
,
()
=>
{
const
input
=
'
?[Ai](https://github.com/syuilo/ai)
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
'
?[Ai](https://github.com/syuilo/ai)
'
);
});
it
(
'
fn
'
,
()
=>
{
const
input
=
'
$[tada Hello]
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
'
$[tada Hello]
'
);
});
it
(
'
fn with arguments
'
,
()
=>
{
const
input
=
'
$[spin.speed=1s,alternate Hello]
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input
)),
'
$[spin.speed=1s,alternate Hello]
'
);
});
it
(
'
preserve url brackets
'
,
()
=>
{
const
input1
=
'
https://github.com/syuilo/ai
'
;
assert
.
strictEqual
(
mfm
.
toString
(
mfm
.
parse
(
input1
)),
input1
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment