From 5c014193c7e655e3619c65fba128b5b9dd450c30 Mon Sep 17 00:00:00 2001 From: syuilo Date: Wed, 18 Jan 2017 05:39:54 +0900 Subject: [PATCH] test --- test/api.js | 48 +++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/test/api.js b/test/api.js index 8b4786f11..2773540ba 100644 --- a/test/api.js +++ b/test/api.js @@ -213,6 +213,52 @@ describe('API', () => { done(); }); })); + + it('存在しないリプライ先で怒られる', () => new Promise(async (done) => { + const me = await insertSakurako(); + const post = { + text: 'さく', + reply_to_id: '000000000000000000000000' + }; + request('/posts/create', post, me).then(res => { + res.should.have.status(400); + done(); + }); + })); + + it('存在しないrepost対象で怒られる', () => new Promise(async (done) => { + const me = await insertSakurako(); + const post = { + repost_id: '000000000000000000000000' + }; + request('/posts/create', post, me).then(res => { + res.should.have.status(400); + done(); + }); + })); + + it('不正なリプライ先IDで怒られる', () => new Promise(async (done) => { + const me = await insertSakurako(); + const post = { + text: 'さく', + reply_to_id: 'kyoppie' + }; + request('/posts/create', post, me).then(res => { + res.should.have.status(400); + done(); + }); + })); + + it('不正なrepost対象IDで怒られる', () => new Promise(async (done) => { + const me = await insertSakurako(); + const post = { + repost_id: 'kyoppie' + }; + request('/posts/create', post, me).then(res => { + res.should.have.status(400); + done(); + }); + })); }); describe('following/create', () => { @@ -262,7 +308,7 @@ describe('API', () => { it('存在しないユーザーはフォローできない', () => new Promise(async (done) => { const me = await insertSakurako(); request('/following/create', { - user_id: '587e7c4b520fb00aa49a5684' + user_id: '000000000000000000000000' }, me).then(res => { res.should.have.status(400); done();