mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-11-30 12:13:08 +02:00
[Test] Add MFM test
This commit is contained in:
parent
9dd21a19ff
commit
501b07c383
1 changed files with 13 additions and 6 deletions
19
test/mfm.ts
19
test/mfm.ts
|
@ -213,40 +213,47 @@ describe('Text', () => {
|
||||||
it('search', () => {
|
it('search', () => {
|
||||||
const tokens1 = analyze('a b c 検索');
|
const tokens1 = analyze('a b c 検索');
|
||||||
assert.deepEqual([
|
assert.deepEqual([
|
||||||
{ type: 'search', content: 'a b c 検索', query: 'a b c'}
|
{ type: 'search', content: 'a b c 検索', query: 'a b c' }
|
||||||
], tokens1);
|
], tokens1);
|
||||||
|
|
||||||
const tokens2 = analyze('a b c Search');
|
const tokens2 = analyze('a b c Search');
|
||||||
assert.deepEqual([
|
assert.deepEqual([
|
||||||
{ type: 'search', content: 'a b c Search', query: 'a b c'}
|
{ type: 'search', content: 'a b c Search', query: 'a b c' }
|
||||||
], tokens2);
|
], tokens2);
|
||||||
|
|
||||||
const tokens3 = analyze('a b c search');
|
const tokens3 = analyze('a b c search');
|
||||||
assert.deepEqual([
|
assert.deepEqual([
|
||||||
{ type: 'search', content: 'a b c search', query: 'a b c'}
|
{ type: 'search', content: 'a b c search', query: 'a b c' }
|
||||||
], tokens3);
|
], tokens3);
|
||||||
|
|
||||||
const tokens4 = analyze('a b c SEARCH');
|
const tokens4 = analyze('a b c SEARCH');
|
||||||
assert.deepEqual([
|
assert.deepEqual([
|
||||||
{ type: 'search', content: 'a b c SEARCH', query: 'a b c'}
|
{ type: 'search', content: 'a b c SEARCH', query: 'a b c' }
|
||||||
], tokens4);
|
], tokens4);
|
||||||
});
|
});
|
||||||
|
|
||||||
it('title', () => {
|
it('title', () => {
|
||||||
const tokens1 = analyze('【yee】\nhaw');
|
const tokens1 = analyze('【yee】\nhaw');
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
{ type: 'title', content: '【yee】\n', title: 'yee'}
|
{ type: 'title', content: '【yee】\n', title: 'yee' }
|
||||||
, tokens1[0]);
|
, tokens1[0]);
|
||||||
|
|
||||||
const tokens2 = analyze('[yee]\nhaw');
|
const tokens2 = analyze('[yee]\nhaw');
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
{ type: 'title', content: '[yee]\n', title: 'yee'}
|
{ type: 'title', content: '[yee]\n', title: 'yee' }
|
||||||
, tokens2[0]);
|
, tokens2[0]);
|
||||||
|
|
||||||
const tokens3 = analyze('a [a]\nb [b]\nc [c]');
|
const tokens3 = analyze('a [a]\nb [b]\nc [c]');
|
||||||
assert.deepEqual(
|
assert.deepEqual(
|
||||||
{ type: 'text', content: 'a [a]\nb [b]\nc [c]' }
|
{ type: 'text', content: 'a [a]\nb [b]\nc [c]' }
|
||||||
, tokens3[0]);
|
, tokens3[0]);
|
||||||
|
|
||||||
|
const tokens4 = analyze('foo\n【bar】\nbuzz');
|
||||||
|
assert.deepEqual([
|
||||||
|
{ type: 'foo', content: 'foo\n' },
|
||||||
|
{ type: 'title', content: '【bar】\n', title: 'bar' },
|
||||||
|
{ type: 'foo', content: 'buzz' },
|
||||||
|
], tokens4);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue