Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 35 additions & 0 deletions frontend/src/components/Chat/ChatWindow.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -7046,4 +7046,39 @@ describe("ChatWindow Integration", () => {
})))
})
})

describe('converter restoration warning', () => {
it('does not show converter restoration warning on fresh empty chat with no conversation', async () => {
render(
<TestWrapper>
<ChatWindow
{...defaultProps}
activeTarget={mockTarget}
attackResultId={null}
conversationId={null}
activeConversationId={null}
defaultsReady={true}
/>
</TestWrapper>,
)
expect(screen.queryByText(/Converter choices could not be restored/)).not.toBeInTheDocument()
expect(screen.getByText('There are no messages in this conversation yet.')).toBeInTheDocument()
})

it('does not show converter restoration warning while fresh chat is loading without active target', async () => {
render(
<TestWrapper>
<ChatWindow
{...defaultProps}
activeTarget={null}
attackResultId={null}
conversationId={null}
activeConversationId={null}
defaultsReady={false}
/>
</TestWrapper>,
)
expect(screen.queryByText(/Converter choices could not be restored/)).not.toBeInTheDocument()
})
})
})
2 changes: 1 addition & 1 deletion frontend/src/components/Chat/ChatWindow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1828,7 +1828,7 @@ export default function ChatWindow({
</MessageBar>
)}
<div hidden={editDraft !== null}>
{recoveredDraftWarningConversationId === viewedConversationId && (
{Boolean(recoveredDraftWarningConversationId) && recoveredDraftWarningConversationId === viewedConversationId && (
<MessageBar intent="warning">
<MessageBarBody>Converter choices could not be restored. Select and apply converters again before sending.</MessageBarBody>
</MessageBar>
Expand Down
Loading