Merge pull request #899 from Hexastack/897-bug---missing-content-payloadtype-prevents-configuring-postback-button-with-content-trigger
Some checks failed
Build and Push Docker API Image / build-and-push (push) Has been cancelled
Build and Push Docker Base Image / build-and-push (push) Has been cancelled
Build and Push Docker UI Image / build-and-push (push) Has been cancelled

fix: add missing content payloadType
This commit is contained in:
Yassine 2025-04-10 14:21:47 +01:00 committed by GitHub
commit 76b155f373
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 27 additions and 0 deletions

View File

@ -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);
});
});

View File

@ -42,4 +42,5 @@ export enum PayloadType {
button = 'button',
outcome = 'outcome',
menu = 'menu',
content = 'content',
}