mirror of
https://git.joinsharkey.org/Sharkey/Sharkey.git
synced 2024-12-23 17:53:08 +02:00
[API] Fix bug
This commit is contained in:
parent
03732b66c8
commit
9fa0b06b78
2 changed files with 13 additions and 2 deletions
|
@ -53,8 +53,6 @@ module.exports = (params, user, app) =>
|
||||||
let media = params.media_ids;
|
let media = params.media_ids;
|
||||||
let files = [];
|
let files = [];
|
||||||
if (media !== undefined && media !== null) {
|
if (media !== undefined && media !== null) {
|
||||||
media = media.split(',');
|
|
||||||
|
|
||||||
if (media.length > maxMediaCount) {
|
if (media.length > maxMediaCount) {
|
||||||
return rej('too many media');
|
return rej('too many media');
|
||||||
}
|
}
|
||||||
|
|
13
test/api.js
13
test/api.js
|
@ -220,6 +220,19 @@ describe('API', () => {
|
||||||
});
|
});
|
||||||
}));
|
}));
|
||||||
|
|
||||||
|
it('ファイルを添付できる', () => new Promise(async (done) => {
|
||||||
|
const me = await insertSakurako();
|
||||||
|
const file = await insertDriveFile();
|
||||||
|
request('/posts/create', {
|
||||||
|
media_ids: [file._id.toString()]
|
||||||
|
}, me).then(res => {
|
||||||
|
res.should.have.status(200);
|
||||||
|
res.body.should.be.a('object');
|
||||||
|
res.body.should.have.property('media_ids').eql([file._id.toString()]);
|
||||||
|
done();
|
||||||
|
});
|
||||||
|
}));
|
||||||
|
|
||||||
it('返信できる', () => new Promise(async (done) => {
|
it('返信できる', () => new Promise(async (done) => {
|
||||||
const hima = await insertHimawari();
|
const hima = await insertHimawari();
|
||||||
const himaPost = await db.get('posts').insert({
|
const himaPost = await db.get('posts').insert({
|
||||||
|
|
Loading…
Reference in a new issue