Update text.js

This commit is contained in:
Aya Morisawa 2018-01-21 15:49:31 +09:00 committed by GitHub
parent 5052895518
commit 78e9931524
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -8,7 +8,7 @@ const analyze = require('../built/api/common/text').default;
const syntaxhighlighter = require('../built/api/common/text/core/syntax-highlighter').default; const syntaxhighlighter = require('../built/api/common/text/core/syntax-highlighter').default;
describe('Text', () => { describe('Text', () => {
it('is correctly analyzed', () => { it('can be analyzed', () => {
const tokens = analyze('@himawari お腹ペコい :cat: #yryr'); const tokens = analyze('@himawari お腹ペコい :cat: #yryr');
assert.deepEqual([ assert.deepEqual([
{ type: 'mention', content: '@himawari', username: 'himawari' }, { type: 'mention', content: '@himawari', username: 'himawari' },
@ -19,7 +19,7 @@ describe('Text', () => {
], tokens); ], tokens);
}); });
it('逆関数で正しく復元できる', () => { it('can be inverted', () => {
const text = '@himawari お腹ペコい :cat: #yryr'; const text = '@himawari お腹ペコい :cat: #yryr';
assert.equal(analyze(text).map(x => x.content).join(''), text); assert.equal(analyze(text).map(x => x.content).join(''), text);
}); });