mirror of
https://github.com/strapi/strapi.git
synced 2025-08-05 23:40:04 +00:00

* 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
52 lines
1.0 KiB
JavaScript
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,
|
|
},
|
|
});
|
|
});
|
|
});
|