diff --git a/src/config/mock/database.config.mock.ts b/src/config/mock/database.config.mock.ts new file mode 100644 index 000000000..ae3e12d9c --- /dev/null +++ b/src/config/mock/database.config.mock.ts @@ -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', + }), +); diff --git a/test/test-setup.ts b/test/test-setup.ts index 35d68a2d4..f9bd95eff 100644 --- a/test/test-setup.ts +++ b/test/test-setup.ts @@ -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,