mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2024-11-22 01:36:29 -05:00
test: add and use a mocked DatabaseConfig
Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
parent
89297e748f
commit
513d64493e
2 changed files with 24 additions and 0 deletions
22
src/config/mock/database.config.mock.ts
Normal file
22
src/config/mock/database.config.mock.ts
Normal file
|
@ -0,0 +1,22 @@
|
|||
/*
|
||||
* SPDX-FileCopyrightText: 2022 The HedgeDoc developers (see AUTHORS file)
|
||||
*
|
||||
* SPDX-License-Identifier: AGPL-3.0-only
|
||||
*/
|
||||
import { registerAs } from '@nestjs/config';
|
||||
|
||||
import { DatabaseDialect } from '../database-dialect.enum';
|
||||
import { DatabaseConfig } from '../database.config';
|
||||
|
||||
export default registerAs(
|
||||
'databaseConfig',
|
||||
(): DatabaseConfig => ({
|
||||
dialect: (process.env.HEDGEDOC_TEST_DB_TYPE || 'sqlite') as DatabaseDialect,
|
||||
database: 'hedgedoc',
|
||||
password: 'hedgedoc',
|
||||
host: 'localhost',
|
||||
port: 0,
|
||||
storage: '',
|
||||
username: 'hedgedoc',
|
||||
}),
|
||||
);
|
|
@ -23,6 +23,7 @@ import { DatabaseConfig } from '../src/config/database.config';
|
|||
import appConfigMock from '../src/config/mock/app.config.mock';
|
||||
import authConfigMock from '../src/config/mock/auth.config.mock';
|
||||
import customizationConfigMock from '../src/config/mock/customization.config.mock';
|
||||
import databaseConfigMock from '../src/config/mock/database.config.mock';
|
||||
import externalServicesConfigMock from '../src/config/mock/external-services.config.mock';
|
||||
import mediaConfigMock from '../src/config/mock/media.config.mock';
|
||||
import noteConfigMock from '../src/config/mock/note.config.mock';
|
||||
|
@ -199,6 +200,7 @@ export class TestSetupBuilder {
|
|||
isGlobal: true,
|
||||
load: [
|
||||
appConfigMock,
|
||||
databaseConfigMock,
|
||||
noteConfigMock,
|
||||
authConfigMock,
|
||||
mediaConfigMock,
|
||||
|
|
Loading…
Reference in a new issue