Rémi de Juvigny 3b0e02fe00 Autofix yarn.lock conflict
Signed-off-by: Rémi de Juvigny <remi@hey.com>
2020-09-23 14:25:55 +02:00

43 lines
1.1 KiB
JavaScript

'use strict';
// Helpers.
const { registerAndLogin } = require('../../../test/helpers/auth');
const { createAuthRequest } = require('../../../test/helpers/request');
let rq;
describe('Upload plugin end to end tests', () => {
beforeAll(async () => {
const token = await registerAndLogin();
rq = createAuthRequest(token);
}, 60000);
describe('GET /upload/proxy => Proxy the file', () => {
test('Return the remote URL', async () => {
const res = await rq.get('/upload/proxy', {
qs: {
url: 'https://strapi.io/',
},
});
expect(res.statusCode).toBe(200);
});
test('Accept an url with utf-8 characters', async () => {
const res = await rq.get('/upload/proxy', {
qs: {
url: 'https://strapi.io/?foo=网',
},
});
expect(res.statusCode).toBe(200);
});
test('Return 400 with an invalid url', async () => {
const res = await rq.get('/upload/proxy');
expect(res.statusCode).toBe(400);
expect(res.body).toEqual('Invalid URL');
});
});
});