mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-03-23 21:24:02 +00:00
test: Add helper functions for creation of mock config
Signed-off-by: Tilman Vatteroth <git@tilmanvatteroth.de>
This commit is contained in:
parent
290fea2703
commit
7dd093a44f
1 changed files with 14 additions and 6 deletions
|
@ -3,14 +3,22 @@
|
|||
*
|
||||
* 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 { NoteConfig } from '../note.config';
|
||||
|
||||
export default registerAs(
|
||||
'noteConfig',
|
||||
(): NoteConfig => ({
|
||||
export function createDefaultMockNoteConfig(): NoteConfig {
|
||||
return {
|
||||
maxDocumentLength: 100000,
|
||||
forbiddenNoteIds: ['forbiddenNoteId'],
|
||||
}),
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
export function registerNoteConfig(
|
||||
noteConfig: NoteConfig,
|
||||
): ConfigFactory<NoteConfig> & ConfigFactoryKeyHost<NoteConfig> {
|
||||
return registerAs('noteConfig', (): NoteConfig => noteConfig);
|
||||
}
|
||||
|
||||
export default registerNoteConfig(createDefaultMockNoteConfig());
|
||||
|
|
Loading…
Reference in a new issue