mirror of
https://github.com/hexastack/hexabot
synced 2025-06-26 18:27:28 +00:00
Merge pull request #899 from Hexastack/897-bug---missing-content-payloadtype-prevents-configuring-postback-button-with-content-trigger
fix: add missing content payloadType
This commit is contained in:
commit
76b155f373
@ -361,4 +361,30 @@ describe('BlockController', () => {
|
||||
).toBeDefined();
|
||||
expect(result.patterns).toEqual(updateBlock.patterns);
|
||||
});
|
||||
|
||||
it('should update the block trigger with a content payloadType payload', async () => {
|
||||
jest.spyOn(blockService, 'updateOne');
|
||||
const updateBlock: BlockUpdateDto = {
|
||||
patterns: [
|
||||
{
|
||||
label: 'Content label',
|
||||
value: 'Content value',
|
||||
type: PayloadType.content,
|
||||
},
|
||||
],
|
||||
};
|
||||
const result = await blockController.updateOne(block.id, updateBlock);
|
||||
expect(blockService.updateOne).toHaveBeenCalledWith(block.id, updateBlock);
|
||||
|
||||
expect(
|
||||
result.patterns.find(
|
||||
(pattern) =>
|
||||
typeof pattern === 'object' &&
|
||||
'type' in pattern &&
|
||||
pattern.type === PayloadType.content &&
|
||||
pattern,
|
||||
),
|
||||
).toBeDefined();
|
||||
expect(result.patterns).toEqual(updateBlock.patterns);
|
||||
});
|
||||
});
|
||||
|
||||
@ -42,4 +42,5 @@ export enum PayloadType {
|
||||
button = 'button',
|
||||
outcome = 'outcome',
|
||||
menu = 'menu',
|
||||
content = 'content',
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user