summaryrefslogtreecommitdiff
path: root/test/api.js
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-01-21 07:48:56 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-01-21 07:48:56 +0900
commitd7bf7ff18822b1b25664dd0af097f5ec98c1796e (patch)
treee75dd3417b9c8d8df02dfe6651d25a8dc0e4b2ac /test/api.js
parent[API] Fix: Validate id (diff)
downloadmisskey-d7bf7ff18822b1b25664dd0af097f5ec98c1796e.tar.gz
misskey-d7bf7ff18822b1b25664dd0af097f5ec98c1796e.tar.bz2
misskey-d7bf7ff18822b1b25664dd0af097f5ec98c1796e.zip
[Test] Add some tests
Diffstat (limited to 'test/api.js')
-rw-r--r--test/api.js36
1 files changed, 36 insertions, 0 deletions
diff --git a/test/api.js b/test/api.js
index 5a2a86930d..0de96366cb 100644
--- a/test/api.js
+++ b/test/api.js
@@ -341,6 +341,42 @@ describe('API', () => {
}));
});
+ describe('posts/show', () => {
+ it('投稿が取得できる', () => new Promise(async (done) => {
+ const me = await insertSakurako();
+ const myPost = await db.get('posts').insert({
+ user_id: me._id,
+ text: 'お腹ペコい'
+ });
+ request('/posts/show', {
+ post_id: myPost._id.toString()
+ }, me).then(res => {
+ res.should.have.status(200);
+ res.body.should.be.a('object');
+ res.body.should.have.property('id').eql(myPost._id.toString());
+ done();
+ });
+ }));
+
+ it('投稿が存在しなかったら怒る', () => new Promise(async (done) => {
+ request('/posts/show', {
+ post_id: '000000000000000000000000'
+ }).then(res => {
+ res.should.have.status(400);
+ done();
+ });
+ }));
+
+ it('間違ったIDで怒られる', () => new Promise(async (done) => {
+ request('/posts/show', {
+ post_id: 'kyoppie'
+ }).then(res => {
+ res.should.have.status(400);
+ done();
+ });
+ }));
+ });
+
describe('posts/likes/create', () => {
it('いいねできる', () => new Promise(async (done) => {
const hima = await insertHimawari();