1
0
mirror of https://github.com/hotomoe/hotomoe synced 2024-11-25 07:36:24 +09:00

[Test] Add some drive tests

This commit is contained in:
syuilo 2017-02-12 11:18:36 +09:00
parent 1e4533e069
commit cd5e49c9c2

View File

@ -752,6 +752,34 @@ describe('API', () => {
});
}));
it('存在しないフォルダで怒られる', () => new Promise(async (done) => {
const me = await insertSakurako();
const file = await insertDriveFile({
user_id: me._id
});
request('/drive/files/update', {
file_id: file._id.toString(),
folder_id: '000000000000000000000000'
}, me).then(res => {
res.should.have.status(400);
done();
});
}));
it('不正なフォルダIDで怒られる', () => new Promise(async (done) => {
const me = await insertSakurako();
const file = await insertDriveFile({
user_id: me._id
});
request('/drive/files/update', {
file_id: file._id.toString(),
folder_id: 'kyoppie'
}, me).then(res => {
res.should.have.status(400);
done();
});
}));
it('ファイルが存在しなかったら怒る', () => new Promise(async (done) => {
const me = await insertSakurako();
request('/drive/files/update', {
@ -774,6 +802,20 @@ describe('API', () => {
});
}));
});
describe('drive/folders/create', () => {
it('ドライブのフォルダを作成できる', () => new Promise(async (done) => {
const me = await insertSakurako();
request('/drive/folders/create', {
name: 'my folder'
}, me).then(res => {
res.should.have.status(200);
res.body.should.be.a('object');
res.body.should.have.property('name').eql('my folder');
done();
});
}));
});
});
async function insertSakurako(opts) {