-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #889 from bpatrik/bugfix/config-defaults
Fix config default loading #888
- Loading branch information
Showing
3 changed files
with
28 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
import {expect} from 'chai'; | ||
import {ConfigClassBuilder} from 'typeconfig/node'; | ||
import {ExtensionConfigWrapper} from '../../../../src/backend/model/extension/ExtensionConfigWrapper'; | ||
import {TestHelper} from '../../../TestHelper'; | ||
import * as fs from 'fs'; | ||
|
||
|
||
describe('Config', () => { | ||
beforeEach(async () => { | ||
await fs.promises.rm(TestHelper.TMP_DIR, {recursive: true, force: true}); | ||
}); | ||
afterEach(async () => { | ||
await fs.promises.rm(TestHelper.TMP_DIR, {recursive: true, force: true}); | ||
}); | ||
it('should load default from env', () => { | ||
process.env['default-Media-tempFolder'] = 'test/test'; | ||
const conf = ExtensionConfigWrapper.originalSync(); | ||
expect(conf.Media.tempFolder).to.be.equal('test/test'); | ||
expect(ConfigClassBuilder.attachPrivateInterface(conf.Media).__defaults.tempFolder).to.be.equal('test/test'); | ||
expect(process.env['default-Media-tempFolder']).to.be.equal('test/test'); | ||
const conf2 = ExtensionConfigWrapper.originalSync(); | ||
expect(ConfigClassBuilder.attachPrivateInterface(conf2.Media).__defaults.tempFolder).to.be.equal('test/test'); | ||
expect(conf2.Media.tempFolder).to.be.equal('test/test'); | ||
}); | ||
}); |