Skip to content

Commit

Permalink
Add more UT
Browse files Browse the repository at this point in the history
Signed-off-by: Heng Qian <[email protected]>
  • Loading branch information
qianheng-aws committed Jul 23, 2024
1 parent 327b68d commit 0fb91ea
Showing 1 changed file with 44 additions and 0 deletions.
44 changes: 44 additions & 0 deletions public/tabs/chat/messages/message_content.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,50 @@ describe('<MessageContent />', () => {
expect(screen.queryAllByText('title')).toHaveLength(1);
});

it('should display message(markdown + additionalAction)', () => {
render(
<MessageContent
message={{
type: 'output',
contentType: 'markdown',
additionalActions: [
{
actionType: 'customized_content_type',
message: 'customized title',
content: 'mock customized content',
},
],
content: '# title',
}}
/>
);
expect(screen.queryAllByText('title')).toHaveLength(1);
expect(customizedRenderMock.mock.calls[0][0]).toMatchInlineSnapshot(`
Object {
"content": "mock customized content",
"contentType": "customized_content_type",
"type": "output",
}
`);
expect(customizedRenderMock.mock.calls[0][1].props).toMatchInlineSnapshot(`
Object {
"message": Object {
"additionalActions": Array [
Object {
"actionType": "customized_content_type",
"content": "mock customized content",
"message": "customized title",
},
],
"content": "# title",
"contentType": "markdown",
"type": "output",
},
}
`);
expect(customizedRenderMock.mock.calls[0][1].chatContext).not.toBeUndefined();
});

it('should render customized render content', () => {
render(
<MessageContent
Expand Down

0 comments on commit 0fb91ea

Please sign in to comment.