From 9eef5c4bed24c7faa6cd74f0e36d75ee628c9043 Mon Sep 17 00:00:00 2001 From: abdou6666 Date: Thu, 2 Jan 2025 18:18:29 +0100 Subject: [PATCH] fix: category --- .../chat/controllers/category.contoller.spec.ts | 14 ++++++++------ api/src/chat/repositories/category.repository.ts | 4 ++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/api/src/chat/controllers/category.contoller.spec.ts b/api/src/chat/controllers/category.contoller.spec.ts index 663cd02c..6fd1966e 100644 --- a/api/src/chat/controllers/category.contoller.spec.ts +++ b/api/src/chat/controllers/category.contoller.spec.ts @@ -1,5 +1,5 @@ /* - * Copyright © 2024 Hexastack. All rights reserved. + * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. @@ -102,10 +102,12 @@ describe('CategoryController', () => { }).compile(); categoryService = module.get(CategoryService); categoryController = module.get(CategoryController); - category = await categoryService.findOne({ label: 'test category 1' }); - categoryToDelete = await categoryService.findOne({ + category = (await categoryService.findOne({ + label: 'test category 1', + })) as Category; + categoryToDelete = (await categoryService.findOne({ label: 'test category 2', - }); + })) as Category; }); afterEach(jest.clearAllMocks); @@ -133,9 +135,9 @@ describe('CategoryController', () => { describe('findOne', () => { it('should return the existing category', async () => { jest.spyOn(categoryService, 'findOne'); - const category = await categoryService.findOne({ + const category = (await categoryService.findOne({ label: 'test category 1', - }); + })) as Category; const result = await categoryController.findOne(category.id); expect(categoryService.findOne).toHaveBeenCalledWith(category.id); diff --git a/api/src/chat/repositories/category.repository.ts b/api/src/chat/repositories/category.repository.ts index b6cc53ea..45170306 100644 --- a/api/src/chat/repositories/category.repository.ts +++ b/api/src/chat/repositories/category.repository.ts @@ -1,5 +1,5 @@ /* - * Copyright © 2024 Hexastack. All rights reserved. + * Copyright © 2025 Hexastack. All rights reserved. * * Licensed under the GNU Affero General Public License v3.0 (AGPLv3) with the following additional terms: * 1. The name "Hexabot" is a trademark of Hexastack. You may not use this name in derivative works without express written permission. @@ -27,7 +27,7 @@ export class CategoryRepository extends BaseRepository { @Optional() blockService?: BlockService, ) { super(eventEmitter, model, Category); - this.blockService = blockService; + this.blockService = blockService!; } /**