fix: fix old unit tests

This commit is contained in:
medtaher 2024-09-23 23:55:58 +01:00
parent 92003c471e
commit 982200cc3a
5 changed files with 15 additions and 0 deletions

View File

@ -100,6 +100,7 @@ describe('ContextVarController', () => {
const contextVarCreateDto: ContextVarCreateDto = {
label: 'contextVarLabel2',
name: 'test_add',
permanent: false,
};
const result = await contextVarController.create(contextVarCreateDto);

View File

@ -20,6 +20,9 @@ export class ContextVarCreateDto {
@IsNotEmpty()
@IsString()
name: string;
@ApiProperty({ description: 'Is context var permanent', type: Boolean })
permanent?: boolean;
}
export class ContextVarUpdateDto extends PartialType(ContextVarCreateDto) {}

View File

@ -59,15 +59,18 @@ import { CategoryRepository } from './../repositories/category.repository';
import { BlockService } from './block.service';
import { BotService } from './bot.service';
import { CategoryService } from './category.service';
import { ContextVarService } from './context-var.service';
import { ConversationService } from './conversation.service';
import { MessageService } from './message.service';
import { SubscriberService } from './subscriber.service';
import { BlockRepository } from '../repositories/block.repository';
import { ContextVarRepository } from '../repositories/context-var.repository';
import { ConversationRepository } from '../repositories/conversation.repository';
import { MessageRepository } from '../repositories/message.repository';
import { SubscriberRepository } from '../repositories/subscriber.repository';
import { BlockFull, BlockModel } from '../schemas/block.schema';
import { CategoryModel } from '../schemas/category.schema';
import { ContextVarModel } from '../schemas/context-var.schema';
import {
Conversation,
ConversationFull,
@ -107,6 +110,7 @@ describe('BlockService', () => {
NlpEntityModel,
NlpSampleEntityModel,
NlpSampleModel,
ContextVarModel,
]),
],
providers: [
@ -143,6 +147,8 @@ describe('BlockService', () => {
NlpSampleEntityService,
NlpSampleService,
NlpService,
ContextVarService,
ContextVarRepository,
{
provide: PluginService,
useValue: {},

View File

@ -18,10 +18,12 @@ const contextVars: ContextVarCreateDto[] = [
{
label: 'test context var 1',
name: 'test1',
permanent: false,
},
{
label: 'test context var 2',
name: 'test2',
permanent: false,
},
];

View File

@ -91,6 +91,9 @@ export const subscriberDefaultValues: TFixturesDefaultValues<Subscriber> = {
lastvisit: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000),
retainedFrom: new Date(Date.now() + 7 * 24 * 60 * 60 * 1000),
avatar: null,
/*context: {
vars: {},
}*/ // TODO: add unit tests taking into account the context field
};
export const subscriberFixtures = getFixturesWithDefaultValues<Subscriber>({