Add config to tests in various places

Signed-off-by: David Mehren <git@herrmehren.de>
This commit is contained in:
David Mehren 2021-01-08 12:56:25 +01:00
parent e8e82076d0
commit 18c6694bcb
No known key found for this signature in database
GPG key ID: 185982BA4C42B7C3
4 changed files with 44 additions and 3 deletions

View file

@ -4,8 +4,10 @@
* SPDX-License-Identifier: AGPL-3.0-only
*/
import { ConfigModule } from '@nestjs/config';
import { Test, TestingModule } from '@nestjs/testing';
import { getRepositoryToken } from '@nestjs/typeorm';
import appConfigMock from '../../../config/app.config.mock';
import { LoggerModule } from '../../../logger/logger.module';
import { MediaUpload } from '../../../media/media-upload.entity';
import { MediaModule } from '../../../media/media.module';
@ -26,7 +28,15 @@ describe('Media Controller', () => {
beforeEach(async () => {
const module: TestingModule = await Test.createTestingModule({
controllers: [MediaController],
imports: [LoggerModule, MediaModule, NotesModule],
imports: [
ConfigModule.forRoot({
isGlobal: true,
load: [appConfigMock],
}),
LoggerModule,
MediaModule,
NotesModule,
],
})
.overrideProvider(getRepositoryToken(AuthorColor))
.useValue({})