fix(backend/URLPreviewService): エラーでHTTP 422を出すように (#10339)

* fix(backend/URLPreviewService): エラーでHTTP 402を出すように

* fix import
This commit is contained in:
Kagami Sascha Rosylight 2023-03-19 12:27:17 +01:00 committed by GitHub
parent 2e051c5871
commit e542a030e4
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 6 deletions

View file

@ -841,4 +841,12 @@ describe('Endpoints', () => {
assert.strictEqual(res.body[0].id, carolPost.id);
});
});
describe('URL preview', () => {
test('Error from summaly becomes HTTP 422', async () => {
const res = await simpleGet('/url?url=https://e:xample.com');
assert.strictEqual(res.status, 422);
assert.strictEqual(res.body.error.code, 'URL_PREVIEW_FAILED');
});
});
});