mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
fix: update Chat module unit tests
This commit is contained in:
parent
848bf79005
commit
2e269d390e
@ -84,7 +84,7 @@ export class BlockCreateDto {
|
||||
@IsObjectId({
|
||||
message: 'Attached block must be a valid objectId',
|
||||
})
|
||||
attachedBlock?: string;
|
||||
attachedBlock?: string | null;
|
||||
|
||||
@ApiProperty({ description: 'Block category', type: String })
|
||||
@IsNotEmpty()
|
||||
|
@ -139,10 +139,12 @@ export class Block extends BlockStub {
|
||||
@Transform(({ obj }) => obj.nextBlocks.map((elem) => elem.toString()))
|
||||
nextBlocks: string[];
|
||||
|
||||
@Transform(({ obj }) => obj.attachedBlock?.toString() || null)
|
||||
attachedBlock: string;
|
||||
@Transform(({ obj }) =>
|
||||
obj.attachedBlock ? obj.attachedBlock.toString() : null,
|
||||
)
|
||||
attachedBlock: string | null;
|
||||
|
||||
@Transform(({ obj }) => obj.category.toString())
|
||||
@Transform(({ obj }) => (obj.category ? obj.category.toString() : null))
|
||||
category: string | null;
|
||||
|
||||
@Exclude()
|
||||
@ -164,10 +166,10 @@ export class BlockFull extends BlockStub {
|
||||
nextBlocks: Block[];
|
||||
|
||||
@Type(() => Block)
|
||||
attachedBlock: Block;
|
||||
attachedBlock: Block | null;
|
||||
|
||||
@Type(() => Category)
|
||||
category: Category;
|
||||
category: Category | null;
|
||||
|
||||
@Type(() => Block)
|
||||
previousBlocks?: Block[];
|
||||
|
@ -251,7 +251,7 @@ export class BotService {
|
||||
// If there's labels, they should be already have been assigned
|
||||
assign_labels: [],
|
||||
trigger_labels: [],
|
||||
attachedBlock: undefined,
|
||||
attachedBlock: null,
|
||||
category: undefined as any,
|
||||
previousBlocks: [],
|
||||
};
|
||||
|
1
api/src/utils/test/fixtures/block.ts
vendored
1
api/src/utils/test/fixtures/block.ts
vendored
@ -29,7 +29,6 @@ export const blockDefaultValues: TBlockFixtures['defaultValues'] = {
|
||||
trigger_channels: [],
|
||||
builtin: false,
|
||||
starts_conversation: false,
|
||||
attachedBlock: null,
|
||||
};
|
||||
|
||||
export const blocks: TBlockFixtures['values'][] = [
|
||||
|
@ -105,7 +105,7 @@ export const blockEmpty = {
|
||||
patterns: [],
|
||||
message: [''],
|
||||
nextBlocks: [],
|
||||
};
|
||||
} as unknown as BlockFull;
|
||||
|
||||
// Translation Data
|
||||
export const textResult = ['Hi back !'];
|
||||
|
Loading…
Reference in New Issue
Block a user