summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2016-12-30 13:28:56 +0900
committersyuilo <syuilotan@yahoo.co.jp>2016-12-30 13:28:56 +0900
commit5024b08869c93e0ae701f5bc5f0ff5300fb1a7ec (patch)
treee447db8ef874f81d7b4dd3f474f3f734035bc661
parentv1 (diff)
downloadsharkey-5024b08869c93e0ae701f5bc5f0ff5300fb1a7ec.tar.gz
sharkey-5024b08869c93e0ae701f5bc5f0ff5300fb1a7ec.tar.bz2
sharkey-5024b08869c93e0ae701f5bc5f0ff5300fb1a7ec.zip
Add test
-rw-r--r--package.json3
-rw-r--r--test/text.js21
2 files changed, 23 insertions, 1 deletions
diff --git a/package.json b/package.json
index ab8cf2a206..112d1dbda3 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 0000000000..842b900416
--- /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));
+ });
+*/
+});