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({
|
@IsObjectId({
|
||||||
message: 'Attached block must be a valid objectId',
|
message: 'Attached block must be a valid objectId',
|
||||||
})
|
})
|
||||||
attachedBlock?: string;
|
attachedBlock?: string | null;
|
||||||
|
|
||||||
@ApiProperty({ description: 'Block category', type: String })
|
@ApiProperty({ description: 'Block category', type: String })
|
||||||
@IsNotEmpty()
|
@IsNotEmpty()
|
||||||
|
|||||||
@ -139,10 +139,12 @@ export class Block extends BlockStub {
|
|||||||
@Transform(({ obj }) => obj.nextBlocks.map((elem) => elem.toString()))
|
@Transform(({ obj }) => obj.nextBlocks.map((elem) => elem.toString()))
|
||||||
nextBlocks: string[];
|
nextBlocks: string[];
|
||||||
|
|
||||||
@Transform(({ obj }) => obj.attachedBlock?.toString() || null)
|
@Transform(({ obj }) =>
|
||||||
attachedBlock: string;
|
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;
|
category: string | null;
|
||||||
|
|
||||||
@Exclude()
|
@Exclude()
|
||||||
@ -164,10 +166,10 @@ export class BlockFull extends BlockStub {
|
|||||||
nextBlocks: Block[];
|
nextBlocks: Block[];
|
||||||
|
|
||||||
@Type(() => Block)
|
@Type(() => Block)
|
||||||
attachedBlock: Block;
|
attachedBlock: Block | null;
|
||||||
|
|
||||||
@Type(() => Category)
|
@Type(() => Category)
|
||||||
category: Category;
|
category: Category | null;
|
||||||
|
|
||||||
@Type(() => Block)
|
@Type(() => Block)
|
||||||
previousBlocks?: Block[];
|
previousBlocks?: Block[];
|
||||||
|
|||||||
@ -251,7 +251,7 @@ export class BotService {
|
|||||||
// If there's labels, they should be already have been assigned
|
// If there's labels, they should be already have been assigned
|
||||||
assign_labels: [],
|
assign_labels: [],
|
||||||
trigger_labels: [],
|
trigger_labels: [],
|
||||||
attachedBlock: undefined,
|
attachedBlock: null,
|
||||||
category: undefined as any,
|
category: undefined as any,
|
||||||
previousBlocks: [],
|
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: [],
|
trigger_channels: [],
|
||||||
builtin: false,
|
builtin: false,
|
||||||
starts_conversation: false,
|
starts_conversation: false,
|
||||||
attachedBlock: null,
|
|
||||||
};
|
};
|
||||||
|
|
||||||
export const blocks: TBlockFixtures['values'][] = [
|
export const blocks: TBlockFixtures['values'][] = [
|
||||||
|
|||||||
@ -105,7 +105,7 @@ export const blockEmpty = {
|
|||||||
patterns: [],
|
patterns: [],
|
||||||
message: [''],
|
message: [''],
|
||||||
nextBlocks: [],
|
nextBlocks: [],
|
||||||
};
|
} as unknown as BlockFull;
|
||||||
|
|
||||||
// Translation Data
|
// Translation Data
|
||||||
export const textResult = ['Hi back !'];
|
export const textResult = ['Hi back !'];
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user