tests: fix error codes and HTTP statuses

This commit is contained in:
Johann150 2023-05-07 23:34:34 +02:00
parent eecff514c2
commit 352851f23f
Signed by: Johann150
GPG Key ID: 9EE6577A2A06F8F1
2 changed files with 9 additions and 9 deletions

View File

@ -35,7 +35,7 @@ describe('Block', () => {
const res = await request('/following/create', { userId: alice.id }, bob);
assert.strictEqual(res.status, 400);
assert.strictEqual(res.body.error.id, 'c4ab57cc-4e41-45e9-bfd9-584f61e35ce0');
assert.strictEqual(res.body.error.code, 'BLOCKED');
}));
it('ブロックされているユーザーにリアクションできない', async(async () => {
@ -44,7 +44,7 @@ describe('Block', () => {
const res = await request('/notes/reactions/create', { noteId: note.id, reaction: '👍' }, bob);
assert.strictEqual(res.status, 400);
assert.strictEqual(res.body.error.id, '20ef5475-9f38-4e4c-bd33-de6d979498ec');
assert.strictEqual(res.body.error.code, 'BLOCKED');
}));
it('ブロックされているユーザーに返信できない', async(async () => {
@ -53,7 +53,7 @@ describe('Block', () => {
const res = await request('/notes/create', { replyId: note.id, text: 'yo' }, bob);
assert.strictEqual(res.status, 400);
assert.strictEqual(res.body.error.id, 'b390d7e1-8a5e-46ed-b625-06271cafd3d3');
assert.strictEqual(res.body.error.code, 'BLOCKED');
}));
it('ブロックされているユーザーのートをRenoteできない', async(async () => {
@ -62,7 +62,7 @@ describe('Block', () => {
const res = await request('/notes/create', { renoteId: note.id, text: 'yo' }, bob);
assert.strictEqual(res.status, 400);
assert.strictEqual(res.body.error.id, 'b390d7e1-8a5e-46ed-b625-06271cafd3d3');
assert.strictEqual(res.body.error.code, 'BLOCKED');
}));
// TODO: ユーザーリストに入れられないテスト

View File

@ -158,7 +158,7 @@ describe('Note', () => {
replyId: '000000000000000000000000',
};
const res = await request('/notes/create', post, alice);
assert.strictEqual(res.status, 400);
assert.strictEqual(res.status, 404);
}));
it('存在しないrenote対象で怒られる', async(async () => {
@ -166,7 +166,7 @@ describe('Note', () => {
renoteId: '000000000000000000000000',
};
const res = await request('/notes/create', post, alice);
assert.strictEqual(res.status, 400);
assert.strictEqual(res.status, 404);
}));
it('不正なリプライ先IDで怒られる', async(async () => {
@ -175,7 +175,7 @@ describe('Note', () => {
replyId: 'foo',
};
const res = await request('/notes/create', post, alice);
assert.strictEqual(res.status, 400);
assert.strictEqual(res.status, 404);
}));
it('不正なrenote対象IDで怒られる', async(async () => {
@ -183,7 +183,7 @@ describe('Note', () => {
renoteId: 'foo',
};
const res = await request('/notes/create', post, alice);
assert.strictEqual(res.status, 400);
assert.strictEqual(res.status, 404);
}));
it('存在しないユーザーにメンションできる', async(async () => {
@ -286,7 +286,7 @@ describe('Note', () => {
choice: 2,
}, alice);
assert.strictEqual(res.status, 400);
assert.strictEqual(res.status, 409);
}));
it('許可されている場合は複数投票できる', async(async () => {