From 579b61a8063acfbba0bf1ea6429857b6b2c13800 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 30 Sep 2018 14:46:18 +0900 Subject: [PATCH] Update tests --- test/mfm.ts | 51 ++++++++++++++++++++++++++++++++++++++------------- 1 file changed, 38 insertions(+), 13 deletions(-) diff --git a/test/mfm.ts b/test/mfm.ts index b0c793e44..dc0947e5e 100644 --- a/test/mfm.ts +++ b/test/mfm.ts @@ -54,20 +54,45 @@ describe('Text', () => { ], tokens2); }); - it('mention', () => { - const tokens = analyze('@himawari お腹ペコい'); - assert.deepEqual([ - { type: 'mention', content: '@himawari', username: 'himawari', host: null }, - { type: 'text', content: ' お腹ペコい' } - ], tokens); - }); + describe('mention', () => { + it('local', () => { + const tokens = analyze('@himawari お腹ペコい'); + assert.deepEqual([ + { type: 'mention', content: '@himawari', username: 'himawari', host: null }, + { type: 'text', content: ' お腹ペコい' } + ], tokens); + }); - it('remote mention', () => { - const tokens = analyze('@hima_sub@namori.net お腹ペコい'); - assert.deepEqual([ - { type: 'mention', content: '@hima_sub@namori.net', username: 'hima_sub', host: 'namori.net' }, - { type: 'text', content: ' お腹ペコい' } - ], tokens); + it('remote', () => { + const tokens = analyze('@hima_sub@namori.net お腹ペコい'); + assert.deepEqual([ + { type: 'mention', content: '@hima_sub@namori.net', username: 'hima_sub', host: 'namori.net' }, + { type: 'text', content: ' お腹ペコい' } + ], tokens); + }); +/* + it('ignore', () => { + const tokens = analyze('idolm@ster'); + assert.deepEqual([ + { type: 'text', content: 'idolm@ster' } + ], tokens); + + const tokens2 = analyze('@a\n@b\n@c'); + assert.deepEqual([ + { type: 'mention', content: '@a', username: 'a', host: null }, + { type: 'text', content: '\n' }, + { type: 'mention', content: '@b', username: 'b', host: null }, + { type: 'text', content: '\n' }, + { type: 'mention', content: '@c', username: 'c', host: null } + ], tokens2); + + const tokens3 = analyze('**x**@a'); + assert.deepEqual([ + { type: 'bold', content: '**x**', bold: 'x' }, + { type: 'mention', content: '@a', username: 'a', host: null } + ], tokens3); + }); +*/ }); it('hashtag', () => {