Skip to content

Commit

Permalink
Mock FilesStorageClientAdapterService in task copy timeout test
Browse files Browse the repository at this point in the history
  • Loading branch information
bischofmax committed Oct 24, 2023
1 parent db09494 commit 9a52633
Showing 1 changed file with 8 additions and 4 deletions.
Original file line number Diff line number Diff line change
@@ -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,
Expand All @@ -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.
Expand All @@ -42,6 +44,8 @@ describe('Task copy (API)', () => {
return true;
},
})
.overrideProvider(FilesStorageClientAdapterService)
.useValue(createMock<FilesStorageClientAdapterService>())
.compile();

app = moduleFixture.createNestApplication();
Expand Down

0 comments on commit 9a52633

Please sign in to comment.