diff --git a/api/src/nlp/repositories/nlp-entity.repository.spec.ts b/api/src/nlp/repositories/nlp-entity.repository.spec.ts index aae06248..c0985826 100644 --- a/api/src/nlp/repositories/nlp-entity.repository.spec.ts +++ b/api/src/nlp/repositories/nlp-entity.repository.spec.ts @@ -47,11 +47,9 @@ describe('NlpEntityRepository', () => { let nlpValueRepository: NlpValueRepository; let firstNameNlpEntity: NlpEntity | null; let nlpService: NlpService; - let helperService: HelperService; - let llmNluHelper: LlmNluHelper; beforeAll(async () => { - const { getMocks } = await buildTestingMocks({ + const { getMocks, module } = await buildTestingMocks({ imports: [ rootMongooseTestModule(installNlpValueFixtures), MongooseModule.forFeature([ @@ -86,9 +84,6 @@ describe('NlpEntityRepository', () => { { provide: SettingService, useValue: { - getConfig: jest.fn(() => ({ - chatbot: { lang: { default: 'fr' } }, - })), getSettings: jest.fn(() => ({ chatbot_settings: { default_nlu_helper: 'llm-nlu-helper', @@ -103,23 +98,16 @@ describe('NlpEntityRepository', () => { ], }); - [ - nlpEntityRepository, - nlpValueRepository, - nlpService, - helperService, - llmNluHelper, - ] = await getMocks([ + [nlpEntityRepository, nlpValueRepository, nlpService] = await getMocks([ NlpEntityRepository, NlpValueRepository, NlpService, - HelperService, - LlmNluHelper, ]); firstNameNlpEntity = await nlpEntityRepository.findOne({ name: 'firstname', }); - helperService.register(llmNluHelper); + const llmNluHelper = module.get(LlmNluHelper); + module.get(HelperService).register(llmNluHelper); }); afterAll(closeInMongodConnection); diff --git a/api/src/nlp/repositories/nlp-value.repository.spec.ts b/api/src/nlp/repositories/nlp-value.repository.spec.ts index e17a4aaf..06bf9547 100644 --- a/api/src/nlp/repositories/nlp-value.repository.spec.ts +++ b/api/src/nlp/repositories/nlp-value.repository.spec.ts @@ -54,11 +54,9 @@ describe('NlpValueRepository', () => { let nlpSampleEntityRepository: NlpSampleEntityRepository; let nlpValues: NlpValue[]; let nlpService: NlpService; - let helperService: HelperService; - let llmNluHelper: LlmNluHelper; beforeAll(async () => { - const { getMocks } = await buildTestingMocks({ + const { getMocks, module } = await buildTestingMocks({ imports: [ rootMongooseTestModule(installNlpSampleEntityFixtures), MongooseModule.forFeature([ @@ -95,9 +93,6 @@ describe('NlpValueRepository', () => { { provide: SettingService, useValue: { - getConfig: jest.fn(() => ({ - chatbot: { lang: { default: 'fr' } }, - })), getSettings: jest.fn(() => ({ chatbot_settings: { default_nlu_helper: 'llm-nlu-helper', @@ -111,21 +106,15 @@ describe('NlpValueRepository', () => { ], }); - [ - nlpValueRepository, - nlpSampleEntityRepository, - nlpService, - helperService, - llmNluHelper, - ] = await getMocks([ - NlpValueRepository, - NlpSampleEntityRepository, - NlpService, - HelperService, - LlmNluHelper, - ]); + [nlpValueRepository, nlpSampleEntityRepository, nlpService] = + await getMocks([ + NlpValueRepository, + NlpSampleEntityRepository, + NlpService, + ]); nlpValues = await nlpValueRepository.findAll(); - helperService.register(llmNluHelper); + const llmNluHelper = module.get(LlmNluHelper); + module.get(HelperService).register(llmNluHelper); }); afterAll(closeInMongodConnection);