summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorsyuilo <syuilotan@yahoo.co.jp>2017-02-13 01:10:26 +0900
committersyuilo <syuilotan@yahoo.co.jp>2017-02-13 01:10:26 +0900
commit76887f371b3f64a186e0f0c56fb71da22fbbddfa (patch)
tree8a8b0193be60216e37e4338abf5dec1e5ded977a /test
parent[Test] Fix test (diff)
downloadsharkey-76887f371b3f64a186e0f0c56fb71da22fbbddfa.tar.gz
sharkey-76887f371b3f64a186e0f0c56fb71da22fbbddfa.tar.bz2
sharkey-76887f371b3f64a186e0f0c56fb71da22fbbddfa.zip
[Test] Add some tests
Diffstat (limited to 'test')
-rw-r--r--test/api.js34
1 files changed, 34 insertions, 0 deletions
diff --git a/test/api.js b/test/api.js
index 8a3fef4165..d0f2aecd7d 100644
--- a/test/api.js
+++ b/test/api.js
@@ -235,6 +235,40 @@ describe('API', () => {
});
}));
+ it('他人のファイルは添付できない', () => new Promise(async (done) => {
+ const me = await insertSakurako();
+ const hima = await insertHimawari();
+ const file = await insertDriveFile({
+ user_id: hima._id
+ });
+ request('/posts/create', {
+ media_ids: [file._id.toString()]
+ }, me).then(res => {
+ res.should.have.status(400);
+ done();
+ });
+ }));
+
+ it('存在しないファイルは添付できない', () => new Promise(async (done) => {
+ const me = await insertSakurako();
+ request('/posts/create', {
+ media_ids: ['000000000000000000000000']
+ }, me).then(res => {
+ res.should.have.status(400);
+ done();
+ });
+ }));
+
+ it('不正なファイルIDで怒られる', () => new Promise(async (done) => {
+ const me = await insertSakurako();
+ request('/posts/create', {
+ media_ids: ['kyoppie']
+ }, me).then(res => {
+ res.should.have.status(400);
+ done();
+ });
+ }));
+
it('返信できる', () => new Promise(async (done) => {
const hima = await insertHimawari();
const himaPost = await db.get('posts').insert({