Settings.test.js 669 B

123456789101112131415161718192021222324
  1. import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
  2. describe('Settings', function () {
  3. describe('s3', function () {
  4. const s3Settings = {
  5. bucket1: {
  6. auth_key: 'bucket1_key',
  7. auth_secret: 'bucket1_secret',
  8. },
  9. }
  10. afterEach(() => {
  11. vi.unstubAllEnvs()
  12. })
  13. beforeEach(() => {
  14. vi.stubEnv()
  15. process.env.S3_BUCKET_CREDENTIALS = JSON.stringify(s3Settings)
  16. })
  17. it('should use JSONified env var if present', async function () {
  18. const settings = (await import('@overleaf/settings')).default
  19. expect(settings.filestore.s3.bucketCreds).to.deep.equal(s3Settings)
  20. })
  21. })
  22. })