Skip to content

Commit

Permalink
Add entity manager to uc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bischofmax committed Jan 16, 2024
1 parent 584de6f commit 04a398a
Show file tree
Hide file tree
Showing 7 changed files with 50 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { AntivirusService } from '@infra/antivirus';
import { S3ClientAdapter } from '@infra/s3-client';
import { EntityManager } from '@mikro-orm/core';
import { ObjectId } from '@mikro-orm/mongodb';
import { Action } from '@modules/authorization';
import { AuthorizationReferenceService } from '@modules/authorization/domain';
Expand Down Expand Up @@ -110,6 +111,10 @@ describe('FilesStorageUC', () => {
provide: PreviewService,
useValue: createMock<PreviewService>(),
},
{
provide: EntityManager,
useValue: createMock<EntityManager>(),
},
],
}).compile();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { AntivirusService } from '@infra/antivirus';
import { S3ClientAdapter } from '@infra/s3-client';
import { EntityManager } from '@mikro-orm/core';
import { ObjectId } from '@mikro-orm/mongodb';
import { AuthorizationReferenceService } from '@modules/authorization/domain';
import { HttpService } from '@nestjs/axios';
Expand Down Expand Up @@ -93,6 +94,10 @@ describe('FilesStorageUC delete methods', () => {
provide: PreviewService,
useValue: createMock<PreviewService>(),
},
{
provide: EntityManager,
useValue: createMock<EntityManager>(),
},
],
}).compile();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { AntivirusService } from '@infra/antivirus';
import { S3ClientAdapter } from '@infra/s3-client';
import { EntityManager } from '@mikro-orm/core';
import { ObjectId } from '@mikro-orm/mongodb';
import { AuthorizationReferenceService } from '@modules/authorization/domain';
import { HttpService } from '@nestjs/axios';
import { ForbiddenException } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { AntivirusService } from '@infra/antivirus';
import { S3ClientAdapter } from '@infra/s3-client';
import { fileRecordFactory, setupEntities } from '@shared/testing';
import { LegacyLogger } from '@src/core/logger';
import { AuthorizationReferenceService } from '@modules/authorization/domain';
import { SingleFileParams } from '../controller/dto';
import { FileRecord } from '../entity';
import { FileStorageAuthorizationContext } from '../files-storage.const';
Expand Down Expand Up @@ -79,6 +80,10 @@ describe('FilesStorageUC', () => {
provide: HttpService,
useValue: createMock<HttpService>(),
},
{
provide: EntityManager,
useValue: createMock<EntityManager>(),
},
],
}).compile();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { AntivirusService } from '@infra/antivirus';
import { S3ClientAdapter } from '@infra/s3-client';
import { EntityManager } from '@mikro-orm/core';
import { ObjectId } from '@mikro-orm/mongodb';
import { AuthorizationReferenceService } from '@modules/authorization/domain';
import { HttpService } from '@nestjs/axios';
import { ForbiddenException } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { AntivirusService } from '@infra/antivirus';
import { S3ClientAdapter } from '@infra/s3-client';
import { fileRecordFactory, setupEntities } from '@shared/testing';
import { LegacyLogger } from '@src/core/logger';
import { AuthorizationReferenceService } from '@modules/authorization/domain';
import { SingleFileParams } from '../controller/dto';
import { FileRecord } from '../entity';
import { FileStorageAuthorizationContext } from '../files-storage.const';
Expand Down Expand Up @@ -70,6 +71,10 @@ describe('FilesStorageUC', () => {
provide: PreviewService,
useValue: createMock<PreviewService>(),
},
{
provide: EntityManager,
useValue: createMock<EntityManager>(),
},
],
}).compile();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { AntivirusService } from '@infra/antivirus';
import { S3ClientAdapter } from '@infra/s3-client';
import { EntityManager } from '@mikro-orm/core';
import { ObjectId } from '@mikro-orm/mongodb';
import { AuthorizationReferenceService } from '@modules/authorization/domain';
import { HttpService } from '@nestjs/axios';
import { Test, TestingModule } from '@nestjs/testing';
import { AntivirusService } from '@infra/antivirus';
import { S3ClientAdapter } from '@infra/s3-client';
import { fileRecordFactory, setupEntities } from '@shared/testing';
import { LegacyLogger } from '@src/core/logger';
import { AuthorizationReferenceService } from '@modules/authorization/domain';
import { FileRecordParams } from '../controller/dto';
import { FileRecord, FileRecordParentType } from '../entity';
import { FileStorageAuthorizationContext } from '../files-storage.const';
Expand Down Expand Up @@ -73,6 +74,10 @@ describe('FilesStorageUC', () => {
provide: PreviewService,
useValue: createMock<PreviewService>(),
},
{
provide: EntityManager,
useValue: createMock<EntityManager>(),
},
],
}).compile();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { AntivirusService } from '@infra/antivirus';
import { S3ClientAdapter } from '@infra/s3-client';
import { EntityManager } from '@mikro-orm/core';
import { ObjectId } from '@mikro-orm/mongodb';
import { AuthorizationReferenceService } from '@modules/authorization/domain';
import { HttpService } from '@nestjs/axios';
import { ForbiddenException } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { AntivirusService } from '@infra/antivirus';
import { S3ClientAdapter } from '@infra/s3-client';
import { fileRecordFactory, setupEntities } from '@shared/testing';
import { LegacyLogger } from '@src/core/logger';
import { AuthorizationReferenceService } from '@modules/authorization/domain';
import { FileRecordParams, SingleFileParams } from '../controller/dto';
import { FileRecord, FileRecordParentType } from '../entity';
import { FileStorageAuthorizationContext } from '../files-storage.const';
Expand Down Expand Up @@ -88,6 +89,10 @@ describe('FilesStorageUC', () => {
provide: PreviewService,
useValue: createMock<PreviewService>(),
},
{
provide: EntityManager,
useValue: createMock<EntityManager>(),
},
],
}).compile();

Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { AntivirusService } from '@infra/antivirus';
import { S3ClientAdapter } from '@infra/s3-client';
import { EntityManager } from '@mikro-orm/core';
import { ObjectId } from '@mikro-orm/mongodb';
import { AuthorizationReferenceService } from '@modules/authorization/domain';
import { HttpService } from '@nestjs/axios';
import { Test, TestingModule } from '@nestjs/testing';
import { AntivirusService } from '@infra/antivirus';
import { S3ClientAdapter } from '@infra/s3-client';
import { fileRecordFactory, setupEntities } from '@shared/testing';
import { LegacyLogger } from '@src/core/logger';
import { AuthorizationReferenceService } from '@modules/authorization/domain';
import { RenameFileParams, ScanResultParams, SingleFileParams } from '../controller/dto';
import { FileRecord } from '../entity';
import { FileStorageAuthorizationContext } from '../files-storage.const';
Expand Down Expand Up @@ -67,6 +68,10 @@ describe('FilesStorageUC', () => {
provide: PreviewService,
useValue: createMock<PreviewService>(),
},
{
provide: EntityManager,
useValue: createMock<EntityManager>(),
},
],
}).compile();

Expand Down

0 comments on commit 04a398a

Please sign in to comment.