mirror of
https://github.com/hexastack/hexabot
synced 2025-05-05 21:34:41 +00:00
fix: add content payloadType unit test
This commit is contained in:
parent
551c3ccf35
commit
b96048c7ee
@ -361,4 +361,30 @@ describe('BlockController', () => {
|
|||||||
).toBeDefined();
|
).toBeDefined();
|
||||||
expect(result.patterns).toEqual(updateBlock.patterns);
|
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);
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
Loading…
Reference in New Issue
Block a user