chore: add tests

This commit is contained in:
zyoshoka 2023-11-25 21:17:36 +09:00
parent a404b8af09
commit 61ebb3772a
No known key found for this signature in database
GPG Key ID: 0C2CB8FBA309A5B8
1 changed files with 37 additions and 0 deletions

View File

@ -84,6 +84,7 @@ describe('Webリソース', () => {
aliceUploadedFile = await uploadFile(alice);
alicesPost = await post(alice, {
text: 'test',
fileIds: [aliceUploadedFile.body.id],
});
alicePage = await page(alice, {});
alicePlay = await play(alice, {});
@ -158,6 +159,42 @@ describe('Webリソース', () => {
}));
});
describe.each([
{ ext: 'rss', type: 'application/rss+xml; charset=utf-8' },
{ ext: 'atom', type: 'application/atom+xml; charset=utf-8' },
{ ext: 'json', type: 'application/json; charset=utf-8' },
])('/@:username.with_replies.$ext', ({ ext, type }) => {
const path = (username: string): string => `/@${username}.with_replies.${ext}`;
test('がGETできる。', async () => await ok({
path: path(alice.username),
type,
}));
test('は存在しないユーザーはGETできない。', async () => await notOk({
path: path('nonexisting'),
status: 404,
}));
});
describe.each([
{ ext: 'rss', type: 'application/rss+xml; charset=utf-8' },
{ ext: 'atom', type: 'application/atom+xml; charset=utf-8' },
{ ext: 'json', type: 'application/json; charset=utf-8' },
])('/@:username.with_files.$ext', ({ ext, type }) => {
const path = (username: string): string => `/@${username}.with_files.${ext}`;
test('がGETできる。', async () => await ok({
path: path(alice.username),
type,
}));
test('は存在しないユーザーはGETできない。', async () => await notOk({
path: path('nonexisting'),
status: 404,
}));
});
describe.each([{ path: '/api/foo' }])('$path', ({ path }) => {
test('はGETできない。', async () => await notOk({
path,