Bartosz 8c40d2192d
Fix invalid local uploads path (#6925)
* Fix invalid local uploads path

File upload provider does not consider the strapi configuration. This patch should fix the problem.

* getStaticPath -> uploadDir

* Use config.get method

* plugin-upload tests fix
2020-07-27 17:18:55 +02:00

52 lines
1.0 KiB
JavaScript

const bootstrap = require('../../config/functions/bootstrap');
describe('Upload plugin bootstrap function', () => {
test('Sets default config if id does not exist', async () => {
const setStore = jest.fn(() => {});
const register = jest.fn(() => {});
global.strapi = {
dir: process.cwd(),
admin: {
services: { permission: { actionProvider: { register } } },
},
log: {
error() {},
},
config: {
get() {
return 'public';
},
paths: {},
info: {
dependencies: {},
},
},
plugins: {
upload: {
config: {
provider: 'local',
},
},
},
store() {
return {
get() {
return null;
},
set: setStore,
};
},
};
await bootstrap();
expect(setStore).toHaveBeenCalledWith({
value: {
sizeOptimization: true,
responsiveDimensions: true,
},
});
});
});