mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
Merge branch '1132-issue---api-make-sure-hookentityprepostcreate-is-used-across-the-board' into 1134-issue---api-make-sure-hookentityprepostupdate-is-used-across-the-board
This commit is contained in:
commit
8801e540ab
@ -116,16 +116,17 @@ describe('NlpEntityRepository', () => {
|
||||
|
||||
describe('The deleteCascadeOne function', () => {
|
||||
it('should delete a nlp entity', async () => {
|
||||
nlpValueRepository.eventEmitter.on(
|
||||
'hook:nlpEntity:preDelete',
|
||||
async (...args) => {
|
||||
await nlpService.handleEntityDelete(args[0], args[1]);
|
||||
},
|
||||
);
|
||||
const intentNlpEntity = await nlpEntityRepository.findOne({
|
||||
name: 'intent',
|
||||
});
|
||||
const result = await nlpEntityRepository.deleteOne(intentNlpEntity!.id);
|
||||
|
||||
await nlpService.handleEntityDelete(
|
||||
{},
|
||||
{ _id: intentNlpEntity!.id, builtin: { $ne: true } },
|
||||
);
|
||||
|
||||
expect(result.deletedCount).toEqual(1);
|
||||
|
||||
const intentNlpValues = await nlpValueRepository.find({
|
||||
|
@ -75,8 +75,6 @@ describe('NlpValueRepository', () => {
|
||||
{
|
||||
provide: CACHE_MANAGER,
|
||||
useValue: {
|
||||
del: jest.fn(),
|
||||
get: jest.fn(),
|
||||
set: jest.fn(),
|
||||
},
|
||||
},
|
||||
@ -169,12 +167,13 @@ describe('NlpValueRepository', () => {
|
||||
|
||||
describe('The deleteCascadeOne function', () => {
|
||||
it('should delete a nlp Value', async () => {
|
||||
const result = await nlpValueRepository.deleteOne(nlpValues[1].id);
|
||||
|
||||
await nlpService.handleValueDelete(
|
||||
{},
|
||||
{ _id: nlpValues[1].id, builtin: { $ne: true } },
|
||||
nlpValueRepository.eventEmitter.on(
|
||||
'hook:nlpValue:preDelete',
|
||||
async (...args) => {
|
||||
await nlpService.handleValueDelete(args[0], args[1]);
|
||||
},
|
||||
);
|
||||
const result = await nlpValueRepository.deleteOne(nlpValues[1].id);
|
||||
|
||||
expect(result.deletedCount).toEqual(1);
|
||||
const sampleEntities = await nlpSampleEntityRepository.find({
|
||||
|
Loading…
Reference in New Issue
Block a user