@eeacms/volto-eea-chatbot 2.0.0 → 2.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintrc.js +6 -6
- package/CHANGELOG.md +12 -1
- package/jest-addon.config.js +1 -0
- package/package.json +1 -1
- package/src/ChatBlock/ChatBlockEdit.jsx +2 -1
- package/src/ChatBlock/chat/AIMessage.tsx +20 -16
- package/src/ChatBlock/chat/ChatMessage.tsx +1 -1
- package/src/ChatBlock/chat/ChatWindow.tsx +10 -11
- package/src/ChatBlock/chat/UserMessage.tsx +4 -4
- package/src/ChatBlock/components/AutoResizeTextarea.jsx +1 -1
- package/src/ChatBlock/components/ChatMessageFeedback.jsx +2 -2
- package/src/ChatBlock/components/EmptyState.jsx +1 -1
- package/src/ChatBlock/components/FeedbackModal.jsx +1 -1
- package/src/ChatBlock/components/HalloumiFeedback.jsx +2 -2
- package/src/ChatBlock/components/Source.jsx +2 -2
- package/src/ChatBlock/components/UserActionsToolbar.jsx +3 -3
- package/src/ChatBlock/components/WebResultIcon.tsx +2 -2
- package/src/ChatBlock/components/markdown/ClaimModal.jsx +3 -3
- package/src/ChatBlock/components/markdown/ClaimSegments.jsx +4 -4
- package/src/ChatBlock/components/markdown/{index.js → index.jsx} +1 -1
- package/src/ChatBlock/hooks/useChatController.ts +7 -4
- package/src/ChatBlock/hooks/useChatStreaming.ts +4 -4
- package/src/ChatBlock/hooks/useToolDisplayTiming.ts +1 -1
- package/src/ChatBlock/index.js +8 -0
- package/src/ChatBlock/packets/MultiToolRenderer.tsx +11 -12
- package/src/ChatBlock/packets/RendererComponent.tsx +6 -3
- package/src/ChatBlock/packets/renderers/CustomToolRenderer.tsx +3 -3
- package/src/ChatBlock/packets/renderers/FetchToolRenderer.tsx +3 -3
- package/src/ChatBlock/packets/renderers/ImageToolRenderer.tsx +3 -3
- package/src/ChatBlock/packets/renderers/MessageTextRenderer.tsx +8 -8
- package/src/ChatBlock/packets/renderers/ReasoningRenderer.tsx +5 -5
- package/src/ChatBlock/packets/renderers/SearchToolRenderer.tsx +10 -10
- package/src/ChatBlock/services/messageProcessor.ts +6 -3
- package/src/ChatBlock/services/packetUtils.ts +2 -2
- package/src/ChatBlock/services/streamingService.ts +8 -2
- package/src/ChatBlock/utils/citations.ts +1 -1
- package/src/halloumi/filtering.test.js +199 -1
- package/src/ChatBlock/tests/AIMessage.test.jsx +0 -95
- package/src/ChatBlock/tests/AutoResizeTextarea.test.jsx +0 -49
- package/src/ChatBlock/tests/BlinkingDot.test.jsx +0 -71
- package/src/ChatBlock/tests/ChatMessage.test.jsx +0 -75
- package/src/ChatBlock/tests/ChatMessageFeedback.test.jsx +0 -73
- package/src/ChatBlock/tests/Citation.test.jsx +0 -107
- package/src/ChatBlock/tests/ClaimModal.test.jsx +0 -136
- package/src/ChatBlock/tests/ClaimSegments.test.jsx +0 -206
- package/src/ChatBlock/tests/CustomToolRenderer.test.jsx +0 -241
- package/src/ChatBlock/tests/EmptyState.test.jsx +0 -137
- package/src/ChatBlock/tests/FeedbackModal.test.jsx +0 -138
- package/src/ChatBlock/tests/FetchToolRenderer.test.jsx +0 -161
- package/src/ChatBlock/tests/HalloumiFeedback.test.jsx +0 -94
- package/src/ChatBlock/tests/ImageToolRenderer.test.jsx +0 -178
- package/src/ChatBlock/tests/MessageTextRenderer.test.jsx +0 -227
- package/src/ChatBlock/tests/MultiToolRenderer.test.jsx +0 -134
- package/src/ChatBlock/tests/QualityCheckToggle.test.jsx +0 -105
- package/src/ChatBlock/tests/ReasoningRenderer.test.jsx +0 -163
- package/src/ChatBlock/tests/RelatedQuestions.test.jsx +0 -215
- package/src/ChatBlock/tests/RenderClaimView.test.jsx +0 -191
- package/src/ChatBlock/tests/RendererComponent.test.jsx +0 -139
- package/src/ChatBlock/tests/SearchToolRenderer.test.jsx +0 -295
- package/src/ChatBlock/tests/Source.test.jsx +0 -79
- package/src/ChatBlock/tests/SourceChip.test.jsx +0 -108
- package/src/ChatBlock/tests/Spinner.test.jsx +0 -18
- package/src/ChatBlock/tests/UserActionsToolbar.test.jsx +0 -135
- package/src/ChatBlock/tests/UserMessage.test.jsx +0 -83
- package/src/ChatBlock/tests/WebResultIcon.test.jsx +0 -61
- package/src/ChatBlock/tests/citations.test.js +0 -114
- package/src/ChatBlock/tests/index.test.js +0 -51
- package/src/ChatBlock/tests/messageProcessor.test.jsx +0 -438
- package/src/ChatBlock/tests/packetUtils.test.js +0 -158
- package/src/ChatBlock/tests/schema.test.js +0 -166
- package/src/ChatBlock/tests/streamingService.test.js +0 -467
- package/src/ChatBlock/tests/useChatController.test.jsx +0 -268
- package/src/ChatBlock/tests/useChatStreaming.test.jsx +0 -163
- package/src/ChatBlock/tests/useDeepCompareMemoize.test.js +0 -107
- package/src/ChatBlock/tests/useMarked.test.jsx +0 -107
- package/src/ChatBlock/tests/useQualityMarkers.test.jsx +0 -150
- package/src/ChatBlock/tests/useScrollonStream.test.jsx +0 -121
- package/src/ChatBlock/tests/useToolDisplayTiming.test.jsx +0 -151
- package/src/ChatBlock/tests/utils.test.jsx +0 -241
- package/src/ChatBlock/tests/withOnyxData.test.jsx +0 -81
- /package/src/ChatBlock/{schema.js → schema.jsx} +0 -0
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { render, screen, waitFor } from '@testing-library/react';
|
|
2
|
-
import '@testing-library/jest-dom';
|
|
3
|
-
import withOnyxData from '../hocs/withOnyxData';
|
|
4
|
-
|
|
5
|
-
describe('withOnyxData', () => {
|
|
6
|
-
it('shows loader initially', () => {
|
|
7
|
-
const TestComponent = ({ data }) => <div>Data: {data}</div>;
|
|
8
|
-
const callback = () => ['data', null, 'test'];
|
|
9
|
-
const WrappedComponent = withOnyxData(callback)(TestComponent);
|
|
10
|
-
|
|
11
|
-
render(<WrappedComponent />);
|
|
12
|
-
|
|
13
|
-
// The Placeholder component should be rendered
|
|
14
|
-
expect(screen.queryByText('Data:')).not.toBeInTheDocument();
|
|
15
|
-
});
|
|
16
|
-
|
|
17
|
-
it('renders component with fetched data', async () => {
|
|
18
|
-
const TestComponent = ({ testData }) => <div>Data: {testData}</div>;
|
|
19
|
-
const mockFetcher = Promise.resolve({ body: 'fetched value' });
|
|
20
|
-
const callback = () => ['testData', mockFetcher, 'test-key'];
|
|
21
|
-
const WrappedComponent = withOnyxData(callback)(TestComponent);
|
|
22
|
-
|
|
23
|
-
render(<WrappedComponent />);
|
|
24
|
-
|
|
25
|
-
await waitFor(() => {
|
|
26
|
-
expect(screen.getByText('Data: fetched value')).toBeInTheDocument();
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
|
|
30
|
-
it('passes original props to wrapped component', async () => {
|
|
31
|
-
const TestComponent = ({ testData, originalProp }) => (
|
|
32
|
-
<div>
|
|
33
|
-
Data: {testData}, Original: {originalProp}
|
|
34
|
-
</div>
|
|
35
|
-
);
|
|
36
|
-
const mockFetcher = Promise.resolve({ body: 'fetched value' });
|
|
37
|
-
const callback = () => ['testData', mockFetcher, 'test-key'];
|
|
38
|
-
const WrappedComponent = withOnyxData(callback)(TestComponent);
|
|
39
|
-
|
|
40
|
-
render(<WrappedComponent originalProp="original value" />);
|
|
41
|
-
|
|
42
|
-
await waitFor(() => {
|
|
43
|
-
expect(
|
|
44
|
-
screen.getByText('Data: fetched value, Original: original value'),
|
|
45
|
-
).toBeInTheDocument();
|
|
46
|
-
});
|
|
47
|
-
});
|
|
48
|
-
|
|
49
|
-
it('handles null fetcher', async () => {
|
|
50
|
-
const TestComponent = ({ data }) => <div>Data: {data || 'none'}</div>;
|
|
51
|
-
const callback = () => ['data', null, 'test'];
|
|
52
|
-
const WrappedComponent = withOnyxData(callback)(TestComponent);
|
|
53
|
-
|
|
54
|
-
render(<WrappedComponent />);
|
|
55
|
-
|
|
56
|
-
// Should stay in loading state
|
|
57
|
-
await new Promise((resolve) => setTimeout(resolve, 100));
|
|
58
|
-
expect(screen.queryByText('Data: none')).not.toBeInTheDocument();
|
|
59
|
-
});
|
|
60
|
-
|
|
61
|
-
it('refetches when depKey changes', async () => {
|
|
62
|
-
const TestComponent = ({ testData }) => <div>Data: {testData}</div>;
|
|
63
|
-
const callback = (props) => {
|
|
64
|
-
const mockFetcher = Promise.resolve({ body: `value-${props.depKey}` });
|
|
65
|
-
return ['testData', mockFetcher, props.depKey];
|
|
66
|
-
};
|
|
67
|
-
const WrappedComponent = withOnyxData(callback)(TestComponent);
|
|
68
|
-
|
|
69
|
-
const { rerender } = render(<WrappedComponent depKey="key1" />);
|
|
70
|
-
|
|
71
|
-
await waitFor(() => {
|
|
72
|
-
expect(screen.getByText('Data: value-key1')).toBeInTheDocument();
|
|
73
|
-
});
|
|
74
|
-
|
|
75
|
-
rerender(<WrappedComponent depKey="key2" />);
|
|
76
|
-
|
|
77
|
-
await waitFor(() => {
|
|
78
|
-
expect(screen.getByText('Data: value-key2')).toBeInTheDocument();
|
|
79
|
-
});
|
|
80
|
-
});
|
|
81
|
-
});
|
|
File without changes
|