2021-06-16 16:42:06 +03:00
|
|
|
const should = require('should');
|
|
|
|
const path = require('path');
|
|
|
|
const configUtils = require('../../../utils/configUtils');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* This is a somewhat legacy set of tests that check we get the right values for storage
|
|
|
|
* We should rethink what the purpose of these tests is.
|
|
|
|
*/
|
|
|
|
|
|
|
|
describe('Adapter Config', function () {
|
|
|
|
before(function () {
|
|
|
|
configUtils.restore();
|
|
|
|
});
|
|
|
|
|
|
|
|
afterEach(function () {
|
|
|
|
configUtils.restore();
|
|
|
|
});
|
|
|
|
|
|
|
|
describe('Storage', function () {
|
|
|
|
it('should default to local-file-store', function () {
|
|
|
|
configUtils.config.get('paths').should.have.property('internalAdaptersPath', path.join(configUtils.config.get('paths').corePath, '/server/adapters/'));
|
|
|
|
|
2021-11-05 15:40:04 +03:00
|
|
|
configUtils.config.get('storage').should.have.property('active', 'LocalImagesStorage');
|
2021-06-16 16:42:06 +03:00
|
|
|
});
|
|
|
|
|
|
|
|
it('no effect: setting a custom active storage as string', function () {
|
|
|
|
configUtils.set({
|
|
|
|
storage: {
|
|
|
|
active: 's3',
|
|
|
|
s3: {}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
configUtils.config.get('storage').should.have.property('active', 's3');
|
|
|
|
configUtils.config.get('storage').should.have.property('s3', {});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('able to set storage for themes (but not officially supported!)', function () {
|
|
|
|
configUtils.set({
|
|
|
|
storage: {
|
|
|
|
active: {
|
|
|
|
images: 'local-file-store',
|
|
|
|
themes: 's3'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
configUtils.config.get('storage').should.have.property('active', {
|
|
|
|
images: 'local-file-store',
|
|
|
|
themes: 's3'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
|
|
|
|
it('should allow setting a custom active storage as object', function () {
|
|
|
|
configUtils.set({
|
|
|
|
storage: {
|
|
|
|
active: {
|
|
|
|
images: 's2',
|
|
|
|
themes: 'local-file-store'
|
|
|
|
}
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
configUtils.config.get('storage').should.have.property('active', {
|
|
|
|
images: 's2',
|
|
|
|
themes: 'local-file-store'
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|
|
|
|
});
|