Merge pull request #11804 from overleaf/jpa-fix-fs-persistor-nested-layout

[object-persistor] forward settings.useSubdirectories to FSPersistor

GitOrigin-RevId: 92cef51c392cfeaebbcca2597740562c1f3fc95f
This commit is contained in:
Jakob Ackermann 2023-02-13 14:35:17 +00:00 committed by Copybot
parent 8a60ae1fae
commit 0b82db0abe
2 changed files with 19 additions and 0 deletions

View file

@ -14,6 +14,7 @@ function getPersistor(backend, settings) {
)
case 'fs':
return new FSPersistor({
useSubdirectories: settings.useSubdirectories,
paths: settings.paths,
Metrics: settings.Metrics,
})

View file

@ -10,6 +10,10 @@ describe('PersistorManager', function () {
beforeEach(function () {
FSPersistor = class {
constructor(settings) {
this.settings = settings
}
wrappedMethod() {
return 'FSPersistor'
}
@ -60,6 +64,20 @@ describe('PersistorManager', function () {
expect(PersistorFactory(Settings).wrappedMethod()).to.equal('FSPersistor')
})
it('should forward useSubdirectories=true to FSPersistor', function () {
Settings.backend = 'fs'
Settings.useSubdirectories = true
expect(PersistorFactory(Settings).settings.useSubdirectories).to.be.true
})
it('should forward useSubdirectories=false to FSPersistor', function () {
Settings.backend = 'fs'
Settings.useSubdirectories = false
expect(PersistorFactory(Settings).settings.useSubdirectories).to.be.false
})
it('should throw an error when the backend is not configured', function () {
try {
PersistorFactory(Settings)