From 6efecc50acbf73d51d45ef7eda422cb789c2cef0 Mon Sep 17 00:00:00 2001 From: hoeppner-dataport Date: Wed, 22 Nov 2023 09:56:05 +0100 Subject: [PATCH] chore: add test for added deleteFilesOfParent --- .../board/repo/recursive-delete.visitor.spec.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/apps/server/src/modules/board/repo/recursive-delete.visitor.spec.ts b/apps/server/src/modules/board/repo/recursive-delete.visitor.spec.ts index 4b0688f0a0d..544d492fe65 100644 --- a/apps/server/src/modules/board/repo/recursive-delete.visitor.spec.ts +++ b/apps/server/src/modules/board/repo/recursive-delete.visitor.spec.ts @@ -1,9 +1,9 @@ import { createMock, DeepMocked } from '@golevelup/ts-jest'; +import { FileRecordParentType } from '@infra/rabbitmq'; import { EntityManager } from '@mikro-orm/mongodb'; import { FileDto, FilesStorageClientAdapterService } from '@modules/files-storage-client'; import { ContextExternalToolService } from '@modules/tool/context-external-tool/service'; import { Test, TestingModule } from '@nestjs/testing'; -import { FileRecordParentType } from '@infra/rabbitmq'; import { columnBoardFactory, columnFactory, @@ -171,6 +171,14 @@ describe(RecursiveDeleteVisitor.name, () => { expect(em.remove).toHaveBeenCalledWith(em.getReference(linkElement.constructor, linkElement.id)); expect(em.remove).toHaveBeenCalledWith(em.getReference(childLinkElement.constructor, childLinkElement.id)); }); + + it('should call deleteFilesOfParent', async () => { + const { linkElement } = setup(); + + await service.visitLinkElementAsync(linkElement); + + expect(filesStorageClientAdapterService.deleteFilesOfParent).toHaveBeenCalledWith(linkElement.id); + }); }); describe('visitSubmissionContainerElementAsync', () => {