test: add and use a mocked DatabaseConfig

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2022-03-06 17:27:27 +01:00
parent 89297e748f
commit 513d64493e
2 changed files with 24 additions and 0 deletions

View 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',
}),
);