mirror of
https://iceshrimp.dev/crimekillz/iceshrimp-161sh.git
synced 2024-11-22 20:23:49 +01:00
[Test] Add some tests
This commit is contained in:
parent
b00f1a85be
commit
c1e35a9bee
30
test/api.js
30
test/api.js
@ -134,7 +134,7 @@ describe('API', () => {
|
||||
}));
|
||||
|
||||
describe('posts/create', () => {
|
||||
it('simple', () => new Promise(async (done) => {
|
||||
it('投稿できる', () => new Promise(async (done) => {
|
||||
const me = await insertSakurako();
|
||||
const post = {
|
||||
text: 'ひまわりー'
|
||||
@ -147,7 +147,7 @@ describe('API', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('reply', () => new Promise(async (done) => {
|
||||
it('返信できる', () => new Promise(async (done) => {
|
||||
const hima = await insertHimawari();
|
||||
const himaPost = await db.get('posts').insert({
|
||||
user_id: hima._id,
|
||||
@ -170,7 +170,7 @@ describe('API', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('repost', () => new Promise(async (done) => {
|
||||
it('repostできる', () => new Promise(async (done) => {
|
||||
const hima = await insertHimawari();
|
||||
const himaPost = await db.get('posts').insert({
|
||||
user_id: hima._id,
|
||||
@ -191,7 +191,7 @@ describe('API', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('引用repost', () => new Promise(async (done) => {
|
||||
it('引用repostできる', () => new Promise(async (done) => {
|
||||
const hima = await insertHimawari();
|
||||
const himaPost = await db.get('posts').insert({
|
||||
user_id: hima._id,
|
||||
@ -214,6 +214,28 @@ describe('API', () => {
|
||||
});
|
||||
}));
|
||||
|
||||
it('文字数ぎりぎりで怒られない', () => new Promise(async (done) => {
|
||||
const me = await insertSakurako();
|
||||
const post = {
|
||||
text: '!'.repeat(500)
|
||||
};
|
||||
request('/posts/create', post, me).then(res => {
|
||||
res.should.have.status(200);
|
||||
done();
|
||||
});
|
||||
}));
|
||||
|
||||
it('文字数オーバーで怒られる', () => new Promise(async (done) => {
|
||||
const me = await insertSakurako();
|
||||
const post = {
|
||||
text: '!'.repeat(501)
|
||||
};
|
||||
request('/posts/create', post, me).then(res => {
|
||||
res.should.have.status(400);
|
||||
done();
|
||||
});
|
||||
}));
|
||||
|
||||
it('存在しないリプライ先で怒られる', () => new Promise(async (done) => {
|
||||
const me = await insertSakurako();
|
||||
const post = {
|
||||
|
Loading…
Reference in New Issue
Block a user