overleaf/services/filestore/test/unit/js/SettingsTests.js

22 lines
654 B
JavaScript
Raw Normal View History

const chai = require('chai')
const { expect } = chai
2020-02-28 10:27:29 -05:00
const SandboxedModule = require('sandboxed-module')
2020-08-10 12:01:12 -04:00
describe('Settings', function () {
describe('s3', function () {
it('should use JSONified env var if present', function () {
2020-01-07 04:46:53 -05:00
const s3Settings = {
bucket1: {
auth_key: 'bucket1_key',
2021-07-13 07:04:46 -04:00
auth_secret: 'bucket1_secret',
},
}
2020-01-07 04:46:53 -05:00
process.env.S3_BUCKET_CREDENTIALS = JSON.stringify(s3Settings)
const settings = SandboxedModule.require('@overleaf/settings', {
2021-07-13 07:04:46 -04:00
globals: { console, process },
2020-02-28 10:27:29 -05:00
})
expect(settings.filestore.s3.bucketCreds).to.deep.equal(s3Settings)
2020-01-07 04:46:53 -05:00
})
})
})