From 39b6011d4ab29df06d62ed9b09282a87b3ae0804 Mon Sep 17 00:00:00 2001 From: "Patrik J. Braun" Date: Mon, 15 Apr 2024 15:05:19 +0200 Subject: [PATCH] Add config def. loading test --- test/common/unit/config/Config.ts | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100644 test/common/unit/config/Config.ts diff --git a/test/common/unit/config/Config.ts b/test/common/unit/config/Config.ts new file mode 100644 index 00000000..747d50a9 --- /dev/null +++ b/test/common/unit/config/Config.ts @@ -0,0 +1,16 @@ +import {expect} from 'chai'; +import { ConfigClassBuilder } from 'typeconfig/node'; +import {ExtensionConfigWrapper} from '../../../../src/backend/model/extension/ExtensionConfigWrapper'; + + +describe('Config', () => { + it('should load default from env', () => { + process.env['default-Media-tempFolder'] = 'test/test' + const conf = ExtensionConfigWrapper.originalSync(); + console.log(ConfigClassBuilder.attachPrivateInterface(conf.Media).__defaults); + 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'); + }); +});