summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-01-17 16:26:21 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-01-17 16:26:21 +0900
commit437283fd951db1eddf093a5433e6fb98b30dcb77 (patch)
tree8c0ae78d9cb1def555999299b8d85a1958af1255
parenttest (diff)
downloadmisskey-437283fd951db1eddf093a5433e6fb98b30dcb77.tar.gz
misskey-437283fd951db1eddf093a5433e6fb98b30dcb77.tar.bz2
misskey-437283fd951db1eddf093a5433e6fb98b30dcb77.zip
test
-rw-r--r--test/api.js32
1 files changed, 30 insertions, 2 deletions
diff --git a/test/api.js b/test/api.js
index 8acda018b5..f3254e6206 100644
--- a/test/api.js
+++ b/test/api.js
@@ -147,9 +147,28 @@ describe('API', () => {
});
}));
- it('reply', () => {
+ it('reply', () => new Promise(async (done) => {
+ const hima = await insertHimawari();
+ const himaPost = await db.get('posts').insert({
+ user_id: hima._id,
+ text: 'ひま'
+ });
- });
+ const me = await insertSakurako();
+ const post = {
+ text: 'さく',
+ reply_to_id: himaPost._id.toString()
+ };
+ request('/posts/create', post, me).then(res => {
+ res.should.have.status(200);
+ res.body.should.be.a('object');
+ res.body.should.have.property('text').eql(post.text);
+ res.body.should.have.property('reply_to_id').eql(post.reply_to_id);
+ res.body.should.have.property('reply_to');
+ res.body.reply_to.should.have.property('text').eql(himaPost.text;
+ done();
+ });
+ }));
it('repost', () => {
@@ -165,3 +184,12 @@ async function insertSakurako() {
password: '$2a$14$wlDw/gDIEE7hHpkJA4yZE.bRUZc.ykHhPfVXPaw2cfOldyParYM76' // HimawariDaisuki06160907
});
}
+
+async function insertHimawari() {
+ return await db.get('users').insert({
+ token: '!00000000000000000000000000000001',
+ username: 'himawari',
+ username_lower: 'himawari',
+ password: '$2a$14$8kwC/akV/Gzk58vsTDAate2ixGjQRtC1j3c4IQAqZ7QLvawRMQsPO' // ilovesakurako
+ });
+}