feat: use mongo test db for unit tests

This commit is contained in:
MohamedAliBouhaouala
2025-05-07 17:47:25 +01:00
committed by Mohamed Marrouchi
parent c7189758a9
commit 9642e823d0
8 changed files with 71 additions and 152 deletions

View File

@@ -201,18 +201,18 @@ describe('NlpEntityController', () => {
describe('findOne', () => {
it('should find a nlp entity', async () => {
const firstNameEntity = await nlpEntityService.findOne({
name: 'first_name',
name: 'firstname',
});
const result = await nlpEntityController.findOne(firstNameEntity!.id, []);
expect(result).toEqualPayload(
nlpEntityFixtures.find(({ name }) => name === 'first_name')!,
nlpEntityFixtures.find(({ name }) => name === 'firstname')!,
);
});
it('should find a nlp entity, and populate its values', async () => {
const firstNameEntity = await nlpEntityService.findOne({
name: 'first_name',
name: 'firstname',
});
const firstNameValues = await nlpValueService.findOne({ value: 'jhon' });
const firstNameWithValues: NlpEntityFull = {
@@ -242,7 +242,7 @@ describe('NlpEntityController', () => {
describe('updateOne', () => {
it('should update a nlp entity', async () => {
const firstNameEntity = await nlpEntityService.findOne({
name: 'first_name',
name: 'firstname',
});
const updatedNlpEntity: NlpEntityCreateDto = {
name: 'updated',