mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
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:
@@ -14,6 +14,7 @@ function getPersistor(backend, settings) {
|
|||||||
)
|
)
|
||||||
case 'fs':
|
case 'fs':
|
||||||
return new FSPersistor({
|
return new FSPersistor({
|
||||||
|
useSubdirectories: settings.useSubdirectories,
|
||||||
paths: settings.paths,
|
paths: settings.paths,
|
||||||
Metrics: settings.Metrics,
|
Metrics: settings.Metrics,
|
||||||
})
|
})
|
||||||
|
|||||||
@@ -10,6 +10,10 @@ describe('PersistorManager', function () {
|
|||||||
|
|
||||||
beforeEach(function () {
|
beforeEach(function () {
|
||||||
FSPersistor = class {
|
FSPersistor = class {
|
||||||
|
constructor(settings) {
|
||||||
|
this.settings = settings
|
||||||
|
}
|
||||||
|
|
||||||
wrappedMethod() {
|
wrappedMethod() {
|
||||||
return 'FSPersistor'
|
return 'FSPersistor'
|
||||||
}
|
}
|
||||||
@@ -60,6 +64,20 @@ describe('PersistorManager', function () {
|
|||||||
expect(PersistorFactory(Settings).wrappedMethod()).to.equal('FSPersistor')
|
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 () {
|
it('should throw an error when the backend is not configured', function () {
|
||||||
try {
|
try {
|
||||||
PersistorFactory(Settings)
|
PersistorFactory(Settings)
|
||||||
|
|||||||
Reference in New Issue
Block a user