mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-24 20:14:35 -04:00
fix(config-mocks): adapt all mock config to use create and register functions
This way it's much easier to change the config provided in tests. Signed-off-by: Philip Molares <philip.molares@udo.edu>
This commit is contained in:
parent
4aadf0bc0d
commit
932075a08f
6 changed files with 113 additions and 37 deletions
|
@ -3,13 +3,13 @@
|
|||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { registerAs } from '@nestjs/config';
|
||||
import { ConfigFactoryKeyHost, registerAs } from '@nestjs/config';
|
||||
import { ConfigFactory } from '@nestjs/config/dist/interfaces';
|
||||
|
||||
import { CustomizationConfig } from '../customization.config';
|
||||
|
||||
export default registerAs(
|
||||
'customizationConfig',
|
||||
(): CustomizationConfig => ({
|
||||
export function createDefaultMockCustomizationConfig(): CustomizationConfig {
|
||||
return {
|
||||
branding: {
|
||||
customName: 'ACME Corp',
|
||||
customLogo: '',
|
||||
|
@ -19,5 +19,19 @@ export default registerAs(
|
|||
termsOfUse: '/test/termsOfUse',
|
||||
imprint: '/test/imprint',
|
||||
},
|
||||
}),
|
||||
};
|
||||
}
|
||||
|
||||
export function registerCustomizationConfig(
|
||||
customizationConfig: CustomizationConfig,
|
||||
): ConfigFactory<CustomizationConfig> &
|
||||
ConfigFactoryKeyHost<CustomizationConfig> {
|
||||
return registerAs(
|
||||
'customizationConfig',
|
||||
(): CustomizationConfig => customizationConfig,
|
||||
);
|
||||
}
|
||||
|
||||
export default registerCustomizationConfig(
|
||||
createDefaultMockCustomizationConfig(),
|
||||
);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue