diff --git a/package.json b/package.json index ab8cf2a20..112d1dbda 100644 --- a/package.json +++ b/package.json @@ -16,7 +16,7 @@ "clean": "gulp clean", "cleanall": "gulp cleanall", "lint": "gulp lint", - "test": "gulp test" + "test": "mocha" }, "dependencies": { "@types/bcrypt": "1.0.0", @@ -96,6 +96,7 @@ "js-yaml": "3.7.0", "livescript": "1.5.0", "mime-types": "2.1.13", + "mocha": "3.2.0", "mongodb": "2.2.16", "ms": "0.7.2", "multer": "1.2.1", diff --git a/test/text.js b/test/text.js new file mode 100644 index 000000000..842b90041 --- /dev/null +++ b/test/text.js @@ -0,0 +1,21 @@ +const assert = require('assert'); + +const analyze = require('../src/common/text'); +//const complie = require('../src/web/app/common/scripts/text-compiler'); + +describe('Text', () => { + it('正しく解析される', () => { + const tokens = analyze('@himawari お腹ペコい #yryr'); + assert.deepEqual([ + { type: 'mention', content: '@himawari', username: 'himawari' }, + { type: 'text', content: ' お腹ペコい ' }, + { type: 'hashtag', content: '#yryr', hashtag: 'yryr' } + ], tokens); + }); + +/* + it('正しくコンパイルされる', () => { + assert.equal(-1, [1,2,3].indexOf(4)); + }); +*/ +});