fix: update NLP module unit tests

This commit is contained in:
yassinedorbozgithub 2025-01-13 15:10:17 +01:00
parent fb4c45d5e0
commit e8c6ff3406
7 changed files with 25 additions and 2 deletions

View File

@ -111,6 +111,8 @@ describe('NlpEntityController', () => {
values: nlpValueFixtures.filter( values: nlpValueFixtures.filter(
({ entity }) => parseInt(entity) === index, ({ entity }) => parseInt(entity) === index,
) as NlpEntityFull['values'], ) as NlpEntityFull['values'],
lookups: curr.lookups!,
builtin: curr.builtin!,
}); });
return acc; return acc;
}, },
@ -214,6 +216,8 @@ describe('NlpEntityController', () => {
id: firstNameEntity!.id, id: firstNameEntity!.id,
createdAt: firstNameEntity!.createdAt, createdAt: firstNameEntity!.createdAt,
updatedAt: firstNameEntity!.updatedAt, updatedAt: firstNameEntity!.updatedAt,
lookups: firstNameEntity!.lookups,
builtin: firstNameEntity!.builtin,
}; };
const result = await nlpEntityController.findOne(firstNameEntity!.id, [ const result = await nlpEntityController.findOne(firstNameEntity!.id, [
'values', 'values',

View File

@ -42,7 +42,7 @@ import { PopulatePipe } from '@/utils/pipes/populate.pipe';
import { SearchFilterPipe } from '@/utils/pipes/search-filter.pipe'; import { SearchFilterPipe } from '@/utils/pipes/search-filter.pipe';
import { TFilterQuery } from '@/utils/types/filter.types'; import { TFilterQuery } from '@/utils/types/filter.types';
import { NlpSampleDto } from '../dto/nlp-sample.dto'; import { NlpSampleDto, TNlpSampleDto } from '../dto/nlp-sample.dto';
import { import {
NlpSample, NlpSample,
NlpSampleFull, NlpSampleFull,
@ -60,7 +60,8 @@ export class NlpSampleController extends BaseController<
NlpSample, NlpSample,
NlpSampleStub, NlpSampleStub,
NlpSamplePopulate, NlpSamplePopulate,
NlpSampleFull NlpSampleFull,
TNlpSampleDto
> { > {
constructor( constructor(
private readonly nlpSampleService: NlpSampleService, private readonly nlpSampleService: NlpSampleService,

View File

@ -100,6 +100,9 @@ describe('NlpValueController', () => {
entity: nlpEntityFixtures[ entity: nlpEntityFixtures[
parseInt(curr.entity) parseInt(curr.entity)
] as NlpValueFull['entity'], ] as NlpValueFull['entity'],
builtin: curr.builtin!,
expressions: curr.expressions!,
metadata: curr.metadata!,
}); });
return acc; return acc;
}, },
@ -123,6 +126,9 @@ describe('NlpValueController', () => {
const ValueWithEntities = { const ValueWithEntities = {
...curr, ...curr,
entity: nlpEntities[parseInt(curr.entity)].id, entity: nlpEntities[parseInt(curr.entity)].id,
expressions: curr.expressions!,
metadata: curr.metadata!,
builtin: curr.builtin!,
}; };
acc.push(ValueWithEntities); acc.push(ValueWithEntities);
return acc; return acc;

View File

@ -113,6 +113,9 @@ describe('NlpSampleEntityRepository', () => {
const ValueWithEntities = { const ValueWithEntities = {
...curr, ...curr,
entity: nlpEntities[0].id, entity: nlpEntities[0].id,
expressions: curr.expressions!,
builtin: curr.builtin!,
metadata: curr.metadata!,
}; };
acc.push(ValueWithEntities); acc.push(ValueWithEntities);
return acc; return acc;

View File

@ -89,6 +89,9 @@ describe('NlpValueRepository', () => {
entity: nlpEntityFixtures[ entity: nlpEntityFixtures[
parseInt(curr.entity) parseInt(curr.entity)
] as NlpValueFull['entity'], ] as NlpValueFull['entity'],
builtin: curr.builtin!,
expressions: curr.expressions!,
metadata: curr.metadata!,
}; };
acc.push(ValueWithEntities); acc.push(ValueWithEntities);
return acc; return acc;

View File

@ -133,6 +133,9 @@ describe('NlpSampleEntityService', () => {
const ValueWithEntities = { const ValueWithEntities = {
...curr, ...curr,
entity: nlpEntities[0].id, entity: nlpEntities[0].id,
expressions: curr.expressions!,
builtin: curr.builtin!,
metadata: curr.metadata!,
}; };
acc.push(ValueWithEntities); acc.push(ValueWithEntities);
return acc; return acc;

View File

@ -97,6 +97,9 @@ describe('NlpValueService', () => {
entity: nlpEntityFixtures[ entity: nlpEntityFixtures[
parseInt(curr.entity) parseInt(curr.entity)
] as NlpValueFull['entity'], ] as NlpValueFull['entity'],
expressions: curr.expressions!,
metadata: curr.metadata!,
builtin: curr.builtin!,
}; };
acc.push(ValueWithEntities); acc.push(ValueWithEntities);
return acc; return acc;