[test] add emoji test

This commit is contained in:
otofune 2017-03-01 03:15:45 +00:00
parent 67ea1498ff
commit e9284a797d

View file

@ -9,10 +9,12 @@ const syntaxhighlighter = require('../src/common/text/core/syntax-highlighter');
describe('Text', () => { describe('Text', () => {
it('is correctly analyzed', () => { it('is correctly analyzed', () => {
const tokens = analyze('@himawari お腹ペコい #yryr'); const tokens = analyze('@himawari お腹ペコい :cat: #yryr');
assert.deepEqual([ assert.deepEqual([
{ type: 'mention', content: '@himawari', username: 'himawari' }, { type: 'mention', content: '@himawari', username: 'himawari' },
{ type: 'text', content: ' お腹ペコい ' }, { type: 'text', content: ' お腹ペコい ' },
{ type: 'emoji', content: ':cat:', emoji: 'cat'},
{ type: 'text', content: ' '},
{ type: 'hashtag', content: '#yryr', hashtag: 'yryr' } { type: 'hashtag', content: '#yryr', hashtag: 'yryr' }
], tokens); ], tokens);
}); });
@ -48,6 +50,13 @@ describe('Text', () => {
], tokens); ], tokens);
}); });
it('emoji', () => {
const tokens = analyze(':cat:');
assert.deepEqual([
{ type: 'emoji', content: ':cat:', emoji: 'cat'}
], tokens);
});
it('block code', () => { it('block code', () => {
const tokens = analyze('```\nvar x = "Strawberry Pasta";\n```'); const tokens = analyze('```\nvar x = "Strawberry Pasta";\n```');
assert.equal(tokens[0].type, 'code'); assert.equal(tokens[0].type, 'code');