Skip to content
Snippets Groups Projects
Commit 152b9470 authored by marihachi's avatar marihachi
Browse files

fix test

parent 487cfba9
No related branches found
No related tags found
No related merge requests found
...@@ -10,7 +10,7 @@ describe('API', () => { ...@@ -10,7 +10,7 @@ describe('API', () => {
const input = const input =
`before `before
<center> <center>
Hello [tada everynyan! 🎉] Hello $[tada everynyan! 🎉]
I'm @ai, A bot of misskey! I'm @ai, A bot of misskey!
...@@ -23,25 +23,25 @@ after`; ...@@ -23,25 +23,25 @@ after`;
describe('inspect', () => { describe('inspect', () => {
it('replace text', () => { it('replace text', () => {
const input = 'good morning [tada everynyan!]'; const input = 'good morning $[tada everynyan!]';
const result = mfm.parse(input); const result = mfm.parse(input);
mfm.inspect(result, node => { mfm.inspect(result, node => {
if (node.type == 'text') { if (node.type == 'text') {
node.props.text = node.props.text.replace(/good morning/g, 'hello'); node.props.text = node.props.text.replace(/good morning/g, 'hello');
} }
}); });
assert.strictEqual(mfm.toString(result), 'hello [tada everynyan!]'); assert.strictEqual(mfm.toString(result), 'hello $[tada everynyan!]');
}); });
it('replace text (one item)', () => { it('replace text (one item)', () => {
const input = 'good morning [tada everyone!]'; const input = 'good morning $[tada everyone!]';
const result = mfm.parse(input); const result = mfm.parse(input);
mfm.inspect(result[1], node => { mfm.inspect(result[1], node => {
if (node.type == 'text') { if (node.type == 'text') {
node.props.text = node.props.text.replace(/one/g, 'nyan'); node.props.text = node.props.text.replace(/one/g, 'nyan');
} }
}); });
assert.strictEqual(mfm.toString(result), 'good morning [tada everynyan!]'); assert.strictEqual(mfm.toString(result), 'good morning $[tada everynyan!]');
}); });
}); });
...@@ -57,7 +57,7 @@ after`; ...@@ -57,7 +57,7 @@ after`;
}); });
it('nested', () => { it('nested', () => {
const nodes = mfm.parse('abc:hoge:[tada 123 @hoge :foo:]:piyo:'); const nodes = mfm.parse('abc:hoge:$[tada 123 @hoge :foo:]:piyo:');
const expect = [ const expect = [
EMOJI_CODE('hoge'), EMOJI_CODE('hoge'),
EMOJI_CODE('foo'), EMOJI_CODE('foo'),
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment