mirror of
https://iceshrimp.dev/limepotato/jormungandr-bite.git
synced 2024-11-22 01:47:39 -07:00
[Test] Add some tests
This commit is contained in:
parent
ee4b83abaa
commit
5009662de7
1 changed files with 34 additions and 0 deletions
34
test/api.js
34
test/api.js
|
@ -423,6 +423,40 @@ describe('API', () => {
|
|||
done();
|
||||
});
|
||||
}));
|
||||
|
||||
it('投票の選択肢が無くて怒られる', () => new Promise(async (done) => {
|
||||
const me = await insertSakurako();
|
||||
request('/posts/create', {
|
||||
poll: {}
|
||||
}, me).then(res => {
|
||||
res.should.have.status(400);
|
||||
done();
|
||||
});
|
||||
}));
|
||||
|
||||
it('投票の選択肢が無くて怒られる (空の配列)', () => new Promise(async (done) => {
|
||||
const me = await insertSakurako();
|
||||
request('/posts/create', {
|
||||
poll: {
|
||||
choices: []
|
||||
}
|
||||
}, me).then(res => {
|
||||
res.should.have.status(400);
|
||||
done();
|
||||
});
|
||||
}));
|
||||
|
||||
it('投票の選択肢が1つで怒られる', () => new Promise(async (done) => {
|
||||
const me = await insertSakurako();
|
||||
request('/posts/create', {
|
||||
poll: {
|
||||
choices: ['Strawberry Pasta']
|
||||
}
|
||||
}, me).then(res => {
|
||||
res.should.have.status(400);
|
||||
done();
|
||||
});
|
||||
}));
|
||||
});
|
||||
|
||||
describe('posts/show', () => {
|
||||
|
|
Loading…
Reference in a new issue