Skip to content

Commit

Permalink
test: 存在しないか他人のファイルは怒られる
Browse files Browse the repository at this point in the history
  • Loading branch information
atsu1125 committed Oct 27, 2024
1 parent 228e3b5 commit 6849b21
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions test/note.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,28 +58,24 @@ describe('Note', () => {
assert.deepStrictEqual(res.body.createdNote.fileIds, [file.id]);
}));

it('他人のファイルは無視', async(async () => {
it('他人のファイルは怒られる', async(async () => {
const file = await uploadFile(bob);

const res = await request('/notes/create', {
text: 'test',
fileIds: [file.id]
}, alice);

assert.strictEqual(res.status, 200);
assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true);
assert.deepStrictEqual(res.body.createdNote.fileIds, []);
assert.strictEqual(res.status, 400);
}));

it('存在しないファイルは無視', async(async () => {
it('存在しないファイルは怒られる', async(async () => {
const res = await request('/notes/create', {
text: 'test',
fileIds: ['000000000000000000000000']
}, alice);

assert.strictEqual(res.status, 200);
assert.strictEqual(typeof res.body === 'object' && !Array.isArray(res.body), true);
assert.deepStrictEqual(res.body.createdNote.fileIds, []);
assert.strictEqual(res.status, 400);
}));

it('不正なファイルIDで怒られる', async(async () => {
Expand Down

0 comments on commit 6849b21

Please sign in to comment.