fix: category

This commit is contained in:
abdou6666 2025-01-02 18:18:29 +01:00
parent 9770a344aa
commit 9eef5c4bed
2 changed files with 10 additions and 8 deletions

View File

@ -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>(CategoryService);
categoryController = module.get<CategoryController>(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);

View File

@ -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<Category> {
@Optional() blockService?: BlockService,
) {
super(eventEmitter, model, Category);
this.blockService = blockService;
this.blockService = blockService!;
}
/**