1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/test/common/unit/config/Config.ts

17 lines
831 B
TypeScript
Raw Normal View History

2024-04-15 21:05:19 +08:00
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');
});
});