From 9a52633b13bace74333a84bd0b7c284efc760bc6 Mon Sep 17 00:00:00 2001 From: Max Bischof Date: Tue, 24 Oct 2023 16:01:15 +0200 Subject: [PATCH] Mock FilesStorageClientAdapterService in task copy timeout test --- .../api-test/task-copy-timeout.api.spec.ts | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/apps/server/src/modules/task/controller/api-test/task-copy-timeout.api.spec.ts b/apps/server/src/modules/task/controller/api-test/task-copy-timeout.api.spec.ts index 446a0fab032..f44a0f92fcb 100644 --- a/apps/server/src/modules/task/controller/api-test/task-copy-timeout.api.spec.ts +++ b/apps/server/src/modules/task/controller/api-test/task-copy-timeout.api.spec.ts @@ -1,9 +1,10 @@ import { Configuration } from '@hpi-schul-cloud/commons/lib'; import { IConfig } from '@hpi-schul-cloud/commons/lib/interfaces/IConfig'; import { EntityManager } from '@mikro-orm/mongodb'; +import { ICurrentUser } from '@modules/authentication'; +import { JwtAuthGuard } from '@modules/authentication/guard/jwt-auth.guard'; import { ExecutionContext, INestApplication } from '@nestjs/common'; import { Test, TestingModule } from '@nestjs/testing'; -import { ICurrentUser } from '@modules/authentication'; import { cleanupCollections, courseFactory, @@ -12,14 +13,15 @@ import { taskFactory, userFactory, } from '@shared/testing'; -import { JwtAuthGuard } from '@modules/authentication/guard/jwt-auth.guard'; import { Request } from 'express'; import request from 'supertest'; +// eslint-disable-next-line import/first +import { createMock } from '@golevelup/ts-jest'; +import { ServerTestModule } from '@modules/server/server.module'; +import { FilesStorageClientAdapterService } from '@src/modules/files-storage-client'; Configuration.set('FEATURE_COPY_SERVICE_ENABLED', true); Configuration.set('INCOMING_REQUEST_TIMEOUT_COPY_API', 1); -// eslint-disable-next-line import/first -import { ServerTestModule } from '@modules/server/server.module'; // This needs to be in a separate test file because of the above configuration. // When we find a way to mock the config, it should be moved alongside the other API tests. @@ -42,6 +44,8 @@ describe('Task copy (API)', () => { return true; }, }) + .overrideProvider(FilesStorageClientAdapterService) + .useValue(createMock()) .compile(); app = moduleFixture.createNestApplication();