mirror of
https://github.com/hotomoe/hotomoe
synced 2024-11-28 23:08:17 +09:00
[Test] Add some drive tests
This commit is contained in:
parent
1e4533e069
commit
cd5e49c9c2
42
test/api.js
42
test/api.js
@ -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) {
|
||||
|
Loading…
Reference in New Issue
Block a user