mirror of
https://github.com/misskey-dev/misskey.git
synced 2024-12-28 22:49:24 +09:00
add test
This commit is contained in:
parent
88c1874943
commit
c6088a1cb3
21
test/api.ts
21
test/api.ts
@ -45,7 +45,26 @@ describe('API', () => {
|
||||
});
|
||||
});
|
||||
|
||||
// TODO: APIエラーのテスト
|
||||
test('error', async () => {
|
||||
fetchMock.resetMocks();
|
||||
fetchMock.mockResponse(async (req) => {
|
||||
return {
|
||||
status: 500,
|
||||
body: JSON.stringify({
|
||||
message: 'Internal error occurred. Please contact us if the error persists.',
|
||||
code: 'INTERNAL_ERROR',
|
||||
id: '5d37dbcb-891e-41ca-a3d6-e690c97775ac',
|
||||
kind: 'server',
|
||||
})
|
||||
};
|
||||
});
|
||||
|
||||
try {
|
||||
await request('https://misskey.test', 'i', {}, 'TOKEN');
|
||||
} catch (e) {
|
||||
expect(e.id).toEqual('5d37dbcb-891e-41ca-a3d6-e690c97775ac');
|
||||
}
|
||||
});
|
||||
|
||||
// TODO: ネットワークエラーのテスト
|
||||
});
|
||||
|
Loading…
Reference in New Issue
Block a user