Ghost/test/unit/shared/config/adapter_config_spec.js
Hannah Wolfe 93f9bc0105
Renamed config index to loader
- Renamed the file in line with our rules around index.js files
- Cleaned up some outdated code patterns
- Want to make the config module a little clearer in what it does
2021-06-16 14:42:06 +01:00

71 lines
2.2 KiB
JavaScript

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/'));
configUtils.config.get('storage').should.have.property('active', 'LocalFileStorage');
});
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'
});
});
});
});