mirror of
https://github.com/hexastack/hexabot
synced 2025-04-25 00:39:43 +00:00
fix: category
This commit is contained in:
parent
9770a344aa
commit
9eef5c4bed
@ -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:
|
* 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.
|
* 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();
|
}).compile();
|
||||||
categoryService = module.get<CategoryService>(CategoryService);
|
categoryService = module.get<CategoryService>(CategoryService);
|
||||||
categoryController = module.get<CategoryController>(CategoryController);
|
categoryController = module.get<CategoryController>(CategoryController);
|
||||||
category = await categoryService.findOne({ label: 'test category 1' });
|
category = (await categoryService.findOne({
|
||||||
categoryToDelete = await categoryService.findOne({
|
label: 'test category 1',
|
||||||
|
})) as Category;
|
||||||
|
categoryToDelete = (await categoryService.findOne({
|
||||||
label: 'test category 2',
|
label: 'test category 2',
|
||||||
});
|
})) as Category;
|
||||||
});
|
});
|
||||||
|
|
||||||
afterEach(jest.clearAllMocks);
|
afterEach(jest.clearAllMocks);
|
||||||
@ -133,9 +135,9 @@ describe('CategoryController', () => {
|
|||||||
describe('findOne', () => {
|
describe('findOne', () => {
|
||||||
it('should return the existing category', async () => {
|
it('should return the existing category', async () => {
|
||||||
jest.spyOn(categoryService, 'findOne');
|
jest.spyOn(categoryService, 'findOne');
|
||||||
const category = await categoryService.findOne({
|
const category = (await categoryService.findOne({
|
||||||
label: 'test category 1',
|
label: 'test category 1',
|
||||||
});
|
})) as Category;
|
||||||
const result = await categoryController.findOne(category.id);
|
const result = await categoryController.findOne(category.id);
|
||||||
|
|
||||||
expect(categoryService.findOne).toHaveBeenCalledWith(category.id);
|
expect(categoryService.findOne).toHaveBeenCalledWith(category.id);
|
||||||
|
@ -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:
|
* 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.
|
* 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,
|
@Optional() blockService?: BlockService,
|
||||||
) {
|
) {
|
||||||
super(eventEmitter, model, Category);
|
super(eventEmitter, model, Category);
|
||||||
this.blockService = blockService;
|
this.blockService = blockService!;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user