Skip to content

Commit

Permalink
Fix mocks in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bischofmax committed Dec 11, 2024
1 parent 026eb2d commit 99148d8
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { ICurrentUser, JwtAuthGuard } from '@infra/auth-guard';
import { TldrawClientAdapter } from '@infra/tldraw-client/tldraw-client.adapter';
import { EntityManager } from '@mikro-orm/mongodb';
import { FilesStorageClientAdapterService } from '@modules/files-storage-client';
import { ServerTestModule } from '@modules/server/server.module';
import { DrawingElementAdapterService } from '@modules/tldraw-client';
import { ExecutionContext, INestApplication } from '@nestjs/common';
import { Test, TestingModule } from '@nestjs/testing';
import { ApiValidationError } from '@shared/common';
Expand Down Expand Up @@ -46,7 +46,7 @@ describe(`content element delete (api)`, () => {
let em: EntityManager;
let currentUser: ICurrentUser;
let filesStorageClientAdapterService: DeepMocked<FilesStorageClientAdapterService>;
let drawingElementAdapterService: DeepMocked<DrawingElementAdapterService>;
let drawingElementAdapterService: DeepMocked<TldrawClientAdapter>;
let api: API;

beforeAll(async () => {
Expand All @@ -55,8 +55,8 @@ describe(`content element delete (api)`, () => {
})
.overrideProvider(FilesStorageClientAdapterService)
.useValue(createMock<FilesStorageClientAdapterService>())
.overrideProvider(DrawingElementAdapterService)
.useValue(createMock<DrawingElementAdapterService>())
.overrideProvider(TldrawClientAdapter)
.useValue(createMock<TldrawClientAdapter>())
.overrideGuard(JwtAuthGuard)
.useValue({
canActivate(context: ExecutionContext) {
Expand All @@ -71,7 +71,7 @@ describe(`content element delete (api)`, () => {
await app.init();
em = module.get(EntityManager);
filesStorageClientAdapterService = module.get(FilesStorageClientAdapterService);
drawingElementAdapterService = module.get(DrawingElementAdapterService);
drawingElementAdapterService = module.get(TldrawClientAdapter);
api = new API(app);
});

Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import { createMock, DeepMocked } from '@golevelup/ts-jest';
import { TldrawClientAdapter } from '@infra/tldraw-client/tldraw-client.adapter';
import { Test, TestingModule } from '@nestjs/testing';
import { setupEntities } from '@shared/testing';
import { CollaborativeTextEditorService } from '@src/modules/collaborative-text-editor';
import { FilesStorageClientAdapterService } from '@src/modules/files-storage-client';
import { DrawingElementAdapterService } from '@src/modules/tldraw-client';
import { ContextExternalToolService } from '@src/modules/tool/context-external-tool';
import { contextExternalToolFactory } from '@src/modules/tool/context-external-tool/testing';
import {
Expand All @@ -19,7 +19,7 @@ describe(BoardNodeDeleteHooksService.name, () => {
let module: TestingModule;
let service: BoardNodeDeleteHooksService;
let filesStorageClientAdapterService: DeepMocked<FilesStorageClientAdapterService>;
let drawingElementAdapterService: DeepMocked<DrawingElementAdapterService>;
let drawingElementAdapterService: DeepMocked<TldrawClientAdapter>;
let contextExternalToolService: DeepMocked<ContextExternalToolService>;
let collaborativeTextEditorService: CollaborativeTextEditorService;

Expand All @@ -36,8 +36,8 @@ describe(BoardNodeDeleteHooksService.name, () => {
useValue: createMock<ContextExternalToolService>(),
},
{
provide: DrawingElementAdapterService,
useValue: createMock<DrawingElementAdapterService>(),
provide: TldrawClientAdapter,
useValue: createMock<TldrawClientAdapter>(),
},
{
provide: CollaborativeTextEditorService,
Expand All @@ -48,7 +48,7 @@ describe(BoardNodeDeleteHooksService.name, () => {

service = module.get(BoardNodeDeleteHooksService);
filesStorageClientAdapterService = module.get(FilesStorageClientAdapterService);
drawingElementAdapterService = module.get(DrawingElementAdapterService);
drawingElementAdapterService = module.get(TldrawClientAdapter);
contextExternalToolService = module.get(ContextExternalToolService);
collaborativeTextEditorService = module.get(CollaborativeTextEditorService);

Expand Down

0 comments on commit 99148d8

Please sign in to comment.