summaryrefslogtreecommitdiff
path: root/test/api.js
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-01-18 05:44:06 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-01-18 05:44:06 +0900
commitaf08b2d8d186ad6faedeec224ac02627ce08706c (patch)
tree743a89c74fab9e1ca3ca8a8927df6c218e66cfe4 /test/api.js
parenttest (diff)
downloadmisskey-af08b2d8d186ad6faedeec224ac02627ce08706c.tar.gz
misskey-af08b2d8d186ad6faedeec224ac02627ce08706c.tar.bz2
misskey-af08b2d8d186ad6faedeec224ac02627ce08706c.zip
[Test] Add some tests
Diffstat (limited to 'test/api.js')
-rw-r--r--test/api.js30
1 files changed, 26 insertions, 4 deletions
diff --git a/test/api.js b/test/api.js
index 2773540baf..23116f687d 100644
--- a/test/api.js
+++ b/test/api.js
@@ -134,7 +134,7 @@ describe('API', () => {
}));
describe('posts/create', () => {
- it('simple', () => new Promise(async (done) => {
+ it('投稿できる', () => new Promise(async (done) => {
const me = await insertSakurako();
const post = {
text: 'ひまわりー'
@@ -147,7 +147,7 @@ describe('API', () => {
});
}));
- it('reply', () => new Promise(async (done) => {
+ it('返信できる', () => new Promise(async (done) => {
const hima = await insertHimawari();
const himaPost = await db.get('posts').insert({
user_id: hima._id,
@@ -170,7 +170,7 @@ describe('API', () => {
});
}));
- it('repost', () => new Promise(async (done) => {
+ it('repostできる', () => new Promise(async (done) => {
const hima = await insertHimawari();
const himaPost = await db.get('posts').insert({
user_id: hima._id,
@@ -191,7 +191,7 @@ describe('API', () => {
});
}));
- it('引用repost', () => new Promise(async (done) => {
+ it('引用repostできる', () => new Promise(async (done) => {
const hima = await insertHimawari();
const himaPost = await db.get('posts').insert({
user_id: hima._id,
@@ -214,6 +214,28 @@ describe('API', () => {
});
}));
+ it('文字数ぎりぎりで怒られない', () => new Promise(async (done) => {
+ const me = await insertSakurako();
+ const post = {
+ text: '!'.repeat(500)
+ };
+ request('/posts/create', post, me).then(res => {
+ res.should.have.status(200);
+ done();
+ });
+ }));
+
+ it('文字数オーバーで怒られる', () => new Promise(async (done) => {
+ const me = await insertSakurako();
+ const post = {
+ text: '!'.repeat(501)
+ };
+ request('/posts/create', post, me).then(res => {
+ res.should.have.status(400);
+ done();
+ });
+ }));
+
it('存在しないリプライ先で怒られる', () => new Promise(async (done) => {
const me = await insertSakurako();
const post = {