Skip to content

Commit

Permalink
Add test for calling adapter from recursive delete visitor
Browse files Browse the repository at this point in the history
  • Loading branch information
blazejpass committed Nov 20, 2023
1 parent cb4f3bf commit cb51740
Showing 1 changed file with 10 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ describe(RecursiveDeleteVisitor.name, () => {
let em: DeepMocked<EntityManager>;
let filesStorageClientAdapterService: DeepMocked<FilesStorageClientAdapterService>;
let contextExternalToolService: DeepMocked<ContextExternalToolService>;
let drawingElementAdapterService: DeepMocked<DrawingElementAdapterService>;

beforeAll(async () => {
module = await Test.createTestingModule({
Expand All @@ -42,6 +43,7 @@ describe(RecursiveDeleteVisitor.name, () => {
em = module.get(EntityManager);
filesStorageClientAdapterService = module.get(FilesStorageClientAdapterService);
contextExternalToolService = module.get(ContextExternalToolService);
drawingElementAdapterService = module.get(DrawingElementAdapterService);

await setupEntities();
});
Expand Down Expand Up @@ -190,6 +192,14 @@ describe(RecursiveDeleteVisitor.name, () => {

expect(em.remove).toHaveBeenCalledWith(em.getReference(childDrawingElement.constructor, childDrawingElement.id));
});

it('should trigger deletion of tldraw data via adapter', async () => {
const { childDrawingElement } = setup();

await service.visitDrawingElementAsync(childDrawingElement);

expect(drawingElementAdapterService.deleteDrawingBinData).toHaveBeenCalledWith(childDrawingElement.drawingName);
});
});

describe('visitSubmissionContainerElementAsync', () => {
Expand Down

0 comments on commit cb51740

Please sign in to comment.