@semiont/react-ui 0.2.35-build.101 → 0.2.35-build.103
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/dist/{EventBusContext-DMI4uwYk.d.mts → EventBusContext-BsIUjdWP.d.mts} +4 -4
- package/dist/{PdfAnnotationCanvas.client-HNYRKFDS.mjs → PdfAnnotationCanvas.client-COQREPXU.mjs} +7 -7
- package/dist/PdfAnnotationCanvas.client-COQREPXU.mjs.map +1 -0
- package/dist/ar-7SUXNE34.mjs +376 -0
- package/dist/ar-7SUXNE34.mjs.map +1 -0
- package/dist/bn-XOET3DOI.mjs +376 -0
- package/dist/bn-XOET3DOI.mjs.map +1 -0
- package/dist/{chunk-YI5IX5ZA.mjs → chunk-2HGWOLVN.mjs} +1 -1
- package/dist/{chunk-YI5IX5ZA.mjs.map → chunk-2HGWOLVN.mjs.map} +1 -1
- package/dist/{chunk-3FIQXKQF.mjs → chunk-Q2KV6Y2J.mjs} +28 -28
- package/dist/{chunk-MWQ5CNKW.mjs → chunk-ZPV43WN2.mjs} +11 -11
- package/dist/chunk-ZPV43WN2.mjs.map +1 -0
- package/dist/cs-X63DXX7L.mjs +376 -0
- package/dist/cs-X63DXX7L.mjs.map +1 -0
- package/dist/da-OWTCV57A.mjs +376 -0
- package/dist/da-OWTCV57A.mjs.map +1 -0
- package/dist/de-77BMFDVF.mjs +376 -0
- package/dist/de-77BMFDVF.mjs.map +1 -0
- package/dist/el-FIBNLH2V.mjs +376 -0
- package/dist/el-FIBNLH2V.mjs.map +1 -0
- package/dist/fa-3N4CIWE6.mjs +376 -0
- package/dist/fa-3N4CIWE6.mjs.map +1 -0
- package/dist/fi-JOM3M7Z4.mjs +376 -0
- package/dist/fi-JOM3M7Z4.mjs.map +1 -0
- package/dist/fr-56QSXS7E.mjs +376 -0
- package/dist/fr-56QSXS7E.mjs.map +1 -0
- package/dist/he-SNAXPJEK.mjs +376 -0
- package/dist/he-SNAXPJEK.mjs.map +1 -0
- package/dist/hi-CRBRD5TB.mjs +376 -0
- package/dist/hi-CRBRD5TB.mjs.map +1 -0
- package/dist/id-BRCVLICF.mjs +376 -0
- package/dist/id-BRCVLICF.mjs.map +1 -0
- package/dist/index.d.mts +164 -164
- package/dist/index.mjs +195 -195
- package/dist/index.mjs.map +1 -1
- package/dist/it-M2Z27BNB.mjs +376 -0
- package/dist/it-M2Z27BNB.mjs.map +1 -0
- package/dist/ja-TZUKW7HD.mjs +376 -0
- package/dist/ja-TZUKW7HD.mjs.map +1 -0
- package/dist/ko-NKBGGOL6.mjs +376 -0
- package/dist/ko-NKBGGOL6.mjs.map +1 -0
- package/dist/ms-XFXPN6RX.mjs +376 -0
- package/dist/ms-XFXPN6RX.mjs.map +1 -0
- package/dist/nl-MVYXAS5C.mjs +379 -0
- package/dist/nl-MVYXAS5C.mjs.map +1 -0
- package/dist/no-XOLO4JPV.mjs +376 -0
- package/dist/no-XOLO4JPV.mjs.map +1 -0
- package/dist/pl-TRWLMMC4.mjs +376 -0
- package/dist/pl-TRWLMMC4.mjs.map +1 -0
- package/dist/pt-M3TE24UI.mjs +376 -0
- package/dist/pt-M3TE24UI.mjs.map +1 -0
- package/dist/ro-QBFG2T64.mjs +376 -0
- package/dist/ro-QBFG2T64.mjs.map +1 -0
- package/dist/sv-IUECBXWX.mjs +376 -0
- package/dist/sv-IUECBXWX.mjs.map +1 -0
- package/dist/test-utils.d.mts +2 -2
- package/dist/test-utils.mjs +2 -2
- package/dist/th-US7KIN5Q.mjs +376 -0
- package/dist/th-US7KIN5Q.mjs.map +1 -0
- package/dist/tr-DWJ2FFUK.mjs +376 -0
- package/dist/tr-DWJ2FFUK.mjs.map +1 -0
- package/dist/uk-M4ZE4DPZ.mjs +376 -0
- package/dist/uk-M4ZE4DPZ.mjs.map +1 -0
- package/dist/vi-FERZNPSH.mjs +376 -0
- package/dist/vi-FERZNPSH.mjs.map +1 -0
- package/dist/zh-3J2I3WYK.mjs +376 -0
- package/dist/zh-3J2I3WYK.mjs.map +1 -0
- package/package.json +1 -1
- package/src/components/AnnotateReferencesProgressWidget.tsx +5 -5
- package/src/components/CodeMirrorRenderer.tsx +5 -5
- package/src/components/Toolbar.tsx +2 -2
- package/src/components/annotation/AnnotateToolbar.tsx +9 -9
- package/src/components/annotation/__tests__/AnnotateToolbar.test.tsx +17 -17
- package/src/components/image-annotation/AnnotationOverlay.tsx +10 -10
- package/src/components/image-annotation/SvgDrawingCanvas.tsx +4 -4
- package/src/components/navigation/CollapsibleResourceNavigation.tsx +7 -7
- package/src/components/navigation/ObservableLink.tsx +3 -3
- package/src/components/navigation/SimpleNavigation.tsx +2 -2
- package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +8 -8
- package/src/components/resource/AnnotateView.tsx +12 -12
- package/src/components/resource/BrowseView.tsx +9 -9
- package/src/components/resource/ResourceViewer.tsx +23 -23
- package/src/components/resource/__tests__/BrowseView.test.tsx +27 -27
- package/src/components/resource/__tests__/ResourceViewer.mode-switch.test.tsx +1 -1
- package/src/components/resource/panels/AssessmentEntry.tsx +2 -2
- package/src/components/resource/panels/AssessmentPanel.tsx +7 -7
- package/src/components/resource/panels/AssistSection.tsx +5 -5
- package/src/components/resource/panels/CommentEntry.tsx +2 -2
- package/src/components/resource/panels/CommentsPanel.tsx +7 -7
- package/src/components/resource/panels/HighlightEntry.tsx +2 -2
- package/src/components/resource/panels/HighlightPanel.tsx +5 -5
- package/src/components/resource/panels/ReferenceEntry.tsx +8 -8
- package/src/components/resource/panels/ReferencesPanel.tsx +10 -10
- package/src/components/resource/panels/ResourceInfoPanel.tsx +6 -6
- package/src/components/resource/panels/TagEntry.tsx +2 -2
- package/src/components/resource/panels/TaggingPanel.tsx +8 -8
- package/src/components/resource/panels/UnifiedAnnotationsPanel.tsx +2 -2
- package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +4 -4
- package/src/components/resource/panels/__tests__/AssistSection.test.tsx +4 -4
- package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +8 -8
- package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +3 -3
- package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +1 -1
- package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +3 -3
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +9 -9
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +5 -5
- package/src/features/admin-devops/components/AdminDevOpsPage.tsx +1 -1
- package/src/features/admin-security/components/AdminSecurityPage.tsx +1 -1
- package/src/features/admin-users/components/AdminUsersPage.tsx +1 -1
- package/src/features/moderate-entity-tags/components/EntityTagsPage.tsx +1 -1
- package/src/features/moderate-recent/components/RecentDocumentsPage.tsx +1 -1
- package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +1 -1
- package/src/features/resource-compose/components/ResourceComposePage.tsx +1 -1
- package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +1 -1
- package/src/features/resource-viewer/__tests__/AnnotationCreationPending.test.tsx +26 -26
- package/src/features/resource-viewer/__tests__/AnnotationDeletionIntegration.test.tsx +21 -21
- package/src/features/resource-viewer/__tests__/AnnotationProgressDismissal.test.tsx +23 -23
- package/src/features/resource-viewer/__tests__/{ResolutionFlowIntegration.test.tsx → BindFlowIntegration.test.tsx} +49 -49
- package/src/features/resource-viewer/__tests__/DetectionFlowBug.test.tsx +18 -18
- package/src/features/resource-viewer/__tests__/DetectionFlowIntegration.test.tsx +19 -19
- package/src/features/resource-viewer/__tests__/ResourceMutations.test.tsx +19 -19
- package/src/features/resource-viewer/__tests__/ToastNotifications.test.tsx +13 -13
- package/src/features/resource-viewer/__tests__/{GenerationFlowIntegration.test.tsx → YieldFlowIntegration.test.tsx} +34 -34
- package/src/features/resource-viewer/__tests__/annotation-progress-flow.test.tsx +11 -11
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +55 -55
- package/translations/ar.json +298 -298
- package/translations/bn.json +298 -298
- package/translations/cs.json +295 -295
- package/translations/da.json +282 -282
- package/translations/de.json +281 -281
- package/translations/el.json +298 -298
- package/translations/fa.json +298 -298
- package/translations/fi.json +298 -298
- package/translations/fr.json +279 -279
- package/translations/he.json +298 -298
- package/translations/hi.json +298 -298
- package/translations/id.json +295 -295
- package/translations/it.json +299 -299
- package/translations/ja.json +298 -298
- package/translations/ko.json +298 -298
- package/translations/ms.json +296 -296
- package/translations/nl.json +299 -296
- package/translations/no.json +292 -292
- package/translations/pl.json +297 -297
- package/translations/pt.json +294 -294
- package/translations/ro.json +298 -298
- package/translations/sv.json +293 -293
- package/translations/th.json +298 -298
- package/translations/tr.json +298 -298
- package/translations/uk.json +298 -298
- package/translations/vi.json +298 -298
- package/translations/zh.json +298 -298
- package/dist/PdfAnnotationCanvas.client-HNYRKFDS.mjs.map +0 -1
- package/dist/ar-MDB7HC5S.mjs +0 -376
- package/dist/ar-MDB7HC5S.mjs.map +0 -1
- package/dist/bn-3SAV2ZEM.mjs +0 -376
- package/dist/bn-3SAV2ZEM.mjs.map +0 -1
- package/dist/chunk-MWQ5CNKW.mjs.map +0 -1
- package/dist/cs-AWCETEUV.mjs +0 -376
- package/dist/cs-AWCETEUV.mjs.map +0 -1
- package/dist/da-UZZHXYLC.mjs +0 -376
- package/dist/da-UZZHXYLC.mjs.map +0 -1
- package/dist/de-LQFWN6S5.mjs +0 -376
- package/dist/de-LQFWN6S5.mjs.map +0 -1
- package/dist/el-IWOETBJ7.mjs +0 -376
- package/dist/el-IWOETBJ7.mjs.map +0 -1
- package/dist/fa-BVEJZT5S.mjs +0 -376
- package/dist/fa-BVEJZT5S.mjs.map +0 -1
- package/dist/fi-JBNCGGA6.mjs +0 -376
- package/dist/fi-JBNCGGA6.mjs.map +0 -1
- package/dist/fr-OLH7PNGI.mjs +0 -376
- package/dist/fr-OLH7PNGI.mjs.map +0 -1
- package/dist/he-KOJQ4HMA.mjs +0 -376
- package/dist/he-KOJQ4HMA.mjs.map +0 -1
- package/dist/hi-BKJFZXAY.mjs +0 -376
- package/dist/hi-BKJFZXAY.mjs.map +0 -1
- package/dist/id-DPLHJVNP.mjs +0 -376
- package/dist/id-DPLHJVNP.mjs.map +0 -1
- package/dist/it-JXHAM7NL.mjs +0 -376
- package/dist/it-JXHAM7NL.mjs.map +0 -1
- package/dist/ja-DQRAO3PU.mjs +0 -376
- package/dist/ja-DQRAO3PU.mjs.map +0 -1
- package/dist/ko-6IFCOP6F.mjs +0 -376
- package/dist/ko-6IFCOP6F.mjs.map +0 -1
- package/dist/ms-KF5S2TLL.mjs +0 -376
- package/dist/ms-KF5S2TLL.mjs.map +0 -1
- package/dist/nl-2GUUZLQM.mjs +0 -376
- package/dist/nl-2GUUZLQM.mjs.map +0 -1
- package/dist/no-2IBCZGEF.mjs +0 -376
- package/dist/no-2IBCZGEF.mjs.map +0 -1
- package/dist/pl-ZEUBJ7YU.mjs +0 -376
- package/dist/pl-ZEUBJ7YU.mjs.map +0 -1
- package/dist/pt-WLAFIZWQ.mjs +0 -376
- package/dist/pt-WLAFIZWQ.mjs.map +0 -1
- package/dist/ro-K56IXFGU.mjs +0 -376
- package/dist/ro-K56IXFGU.mjs.map +0 -1
- package/dist/sv-VFJLMJRY.mjs +0 -376
- package/dist/sv-VFJLMJRY.mjs.map +0 -1
- package/dist/th-RICLQ2GW.mjs +0 -376
- package/dist/th-RICLQ2GW.mjs.map +0 -1
- package/dist/tr-SALXWE2M.mjs +0 -376
- package/dist/tr-SALXWE2M.mjs.map +0 -1
- package/dist/uk-3U3T3O2E.mjs +0 -376
- package/dist/uk-3U3T3O2E.mjs.map +0 -1
- package/dist/vi-LIVNZXOB.mjs +0 -376
- package/dist/vi-LIVNZXOB.mjs.map +0 -1
- package/dist/zh-KDUAZPX3.mjs +0 -376
- package/dist/zh-KDUAZPX3.mjs.map +0 -1
- /package/dist/{chunk-3FIQXKQF.mjs.map → chunk-Q2KV6Y2J.mjs.map} +0 -0
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Tests the COMPLETE annotation deletion flow with real component composition:
|
|
5
5
|
* - EventBusProvider (REAL)
|
|
6
6
|
* - ApiClientProvider (REAL, with MOCKED client)
|
|
7
|
-
* -
|
|
7
|
+
* - useMarkFlow (REAL) — single registration point for useBindFlow
|
|
8
8
|
* - useEventSubscriptions (REAL)
|
|
9
9
|
*
|
|
10
10
|
* This test focuses on ARCHITECTURE and EVENT WIRING:
|
|
@@ -15,18 +15,18 @@
|
|
|
15
15
|
*
|
|
16
16
|
* CRITICAL: This test prevents regressions where:
|
|
17
17
|
* - Multiple deletion paths exist (event-driven vs direct)
|
|
18
|
-
* -
|
|
18
|
+
* - useBindFlow called in more than one hook (causes duplicate subscriptions)
|
|
19
19
|
* - Auth token missing from API calls (401 errors)
|
|
20
20
|
*
|
|
21
|
-
* ARCHITECTURE:
|
|
22
|
-
*
|
|
23
|
-
* and AI-driven SSE detection) plus all API operations via
|
|
21
|
+
* ARCHITECTURE: useBindFlow is called ONLY in useMarkFlow.
|
|
22
|
+
* useMarkFlow handles all detection state (manual annotation selection
|
|
23
|
+
* and AI-driven SSE detection) plus all API operations via useBindFlow.
|
|
24
24
|
*/
|
|
25
25
|
|
|
26
26
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
27
27
|
import { render, waitFor } from '@testing-library/react';
|
|
28
28
|
import { act } from 'react';
|
|
29
|
-
import {
|
|
29
|
+
import { useMarkFlow } from '../../../hooks/useMarkFlow';
|
|
30
30
|
import { EventBusProvider, useEventBus, resetEventBusForTesting } from '../../../contexts/EventBusContext';
|
|
31
31
|
|
|
32
32
|
// Mock Toast module to prevent "useToast must be used within a ToastProvider" errors
|
|
@@ -70,9 +70,9 @@ describe('Annotation Deletion - Feature Integration', () => {
|
|
|
70
70
|
|
|
71
71
|
function TestComponent() {
|
|
72
72
|
eventBusInstance = useEventBus();
|
|
73
|
-
//
|
|
74
|
-
// (handles
|
|
75
|
-
|
|
73
|
+
// useMarkFlow is the single registration point for useBindFlow
|
|
74
|
+
// (handles mark:delete mark:create annotate:detect-request, etc.)
|
|
75
|
+
useMarkFlow(testUri);
|
|
76
76
|
return null;
|
|
77
77
|
}
|
|
78
78
|
|
|
@@ -89,14 +89,14 @@ describe('Annotation Deletion - Feature Integration', () => {
|
|
|
89
89
|
return {
|
|
90
90
|
emitDelete: (annotationId: string) => {
|
|
91
91
|
act(() => {
|
|
92
|
-
eventBusInstance!.get('
|
|
92
|
+
eventBusInstance!.get('mark:delete').next({ annotationId });
|
|
93
93
|
});
|
|
94
94
|
},
|
|
95
95
|
eventBus: eventBusInstance!,
|
|
96
96
|
};
|
|
97
97
|
}
|
|
98
98
|
|
|
99
|
-
it('should call deleteAnnotation API exactly ONCE when
|
|
99
|
+
it('should call deleteAnnotation API exactly ONCE when mark:deleteevent is emitted', async () => {
|
|
100
100
|
const { emitDelete } = renderAnnotationFlow();
|
|
101
101
|
const annotationId = 'annotation-123';
|
|
102
102
|
|
|
@@ -133,12 +133,12 @@ describe('Annotation Deletion - Feature Integration', () => {
|
|
|
133
133
|
expect(callArgs[1].auth).toBe(accessToken(testToken));
|
|
134
134
|
});
|
|
135
135
|
|
|
136
|
-
it('should emit
|
|
136
|
+
it('should emit mark:deleted event on successful deletion', async () => {
|
|
137
137
|
const { emitDelete, eventBus } = renderAnnotationFlow();
|
|
138
138
|
const deletedListener = vi.fn();
|
|
139
139
|
|
|
140
140
|
// Subscribe to success event
|
|
141
|
-
eventBus.get('
|
|
141
|
+
eventBus.get('mark:deleted').subscribe(deletedListener);
|
|
142
142
|
|
|
143
143
|
emitDelete('annotation-789');
|
|
144
144
|
|
|
@@ -155,7 +155,7 @@ describe('Annotation Deletion - Feature Integration', () => {
|
|
|
155
155
|
});
|
|
156
156
|
});
|
|
157
157
|
|
|
158
|
-
it('should emit
|
|
158
|
+
it('should emit mark:delete-failed event on API error', async () => {
|
|
159
159
|
// Make API call fail
|
|
160
160
|
deleteAnnotationSpy.mockRejectedValue(new Error('Network error'));
|
|
161
161
|
|
|
@@ -163,7 +163,7 @@ describe('Annotation Deletion - Feature Integration', () => {
|
|
|
163
163
|
const failedListener = vi.fn();
|
|
164
164
|
|
|
165
165
|
// Subscribe to failure event
|
|
166
|
-
eventBus.get('
|
|
166
|
+
eventBus.get('mark:delete-failed').subscribe(failedListener);
|
|
167
167
|
|
|
168
168
|
emitDelete('annotation-error');
|
|
169
169
|
|
|
@@ -202,13 +202,13 @@ describe('Annotation Deletion - Feature Integration', () => {
|
|
|
202
202
|
expect(deleteAnnotationSpy.mock.calls[1][0]).toContain('annotation-2');
|
|
203
203
|
});
|
|
204
204
|
|
|
205
|
-
it('ARCHITECTURE:
|
|
205
|
+
it('ARCHITECTURE: useBindFlow is called in useMarkFlow (single registration point)', async () => {
|
|
206
206
|
/**
|
|
207
207
|
* This test validates that there's only ONE event-driven deletion path:
|
|
208
|
-
* -
|
|
209
|
-
* -
|
|
208
|
+
* - useMarkFlow calls useBindFlow (the single registration point)
|
|
209
|
+
* - useBindFlow subscribes to annotation:delete
|
|
210
210
|
*
|
|
211
|
-
* If this test fails with 2 API calls, it means
|
|
211
|
+
* If this test fails with 2 API calls, it means useBindFlow was added
|
|
212
212
|
* to a second hook, causing duplicate subscriptions (ARCHITECTURE VIOLATION).
|
|
213
213
|
*/
|
|
214
214
|
|
|
@@ -229,8 +229,8 @@ describe('Annotation Deletion - Feature Integration', () => {
|
|
|
229
229
|
* that bypassed the event bus.
|
|
230
230
|
*
|
|
231
231
|
* The correct pattern is event-driven only:
|
|
232
|
-
* - UI emits
|
|
233
|
-
* -
|
|
232
|
+
* - UI emits mark:deleteevent
|
|
233
|
+
* - useBindFlow handles it
|
|
234
234
|
* - No direct function calls
|
|
235
235
|
*/
|
|
236
236
|
|
|
@@ -8,20 +8,20 @@
|
|
|
8
8
|
* 4. BUG: Progress modal stays visible showing "Processing: Location" indefinitely
|
|
9
9
|
*
|
|
10
10
|
* ROOT CAUSE:
|
|
11
|
-
* -
|
|
11
|
+
* - useMarkFlow.ts (line 54-62): mark:assist-finished clears `assistingMotivation` but keeps `progress`
|
|
12
12
|
* - AssistSection.tsx (line 214): Shows progress UI whenever `progress` is not null
|
|
13
13
|
* - No mechanism to auto-dismiss or manually close the progress display
|
|
14
14
|
*
|
|
15
15
|
* FIX OPTIONS:
|
|
16
16
|
* A) Auto-dismiss after timeout (3s after completion)
|
|
17
17
|
* B) Add "Close" button to progress display
|
|
18
|
-
* C) Clear progress on next
|
|
18
|
+
* C) Clear progress on next mark:assist-request (already works but not ideal UX)
|
|
19
19
|
*/
|
|
20
20
|
|
|
21
21
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
22
22
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
23
23
|
import { act } from 'react';
|
|
24
|
-
import {
|
|
24
|
+
import { useMarkFlow } from '../../../hooks/useMarkFlow';
|
|
25
25
|
import { EventBusProvider, resetEventBusForTesting, useEventBus } from '../../../contexts/EventBusContext';
|
|
26
26
|
import { ApiClientProvider } from '../../../contexts/ApiClientContext';
|
|
27
27
|
import { AuthTokenProvider } from '../../../contexts/AuthTokenContext';
|
|
@@ -65,7 +65,7 @@ describe('Detection Progress Dismissal Bug', () => {
|
|
|
65
65
|
|
|
66
66
|
function TestHarness() {
|
|
67
67
|
eventBusInstance = useEventBus();
|
|
68
|
-
const { assistingMotivation, progress } =
|
|
68
|
+
const { assistingMotivation, progress } = useMarkFlow(rUri);
|
|
69
69
|
|
|
70
70
|
return (
|
|
71
71
|
<div>
|
|
@@ -91,9 +91,9 @@ describe('Detection Progress Dismissal Bug', () => {
|
|
|
91
91
|
expect(screen.getByTestId('detecting')).toHaveTextContent('none');
|
|
92
92
|
expect(screen.getByTestId('progress')).toHaveTextContent('no progress');
|
|
93
93
|
|
|
94
|
-
// User clicks detect button (emits
|
|
94
|
+
// User clicks detect button (emits mark:assist-request)
|
|
95
95
|
act(() => {
|
|
96
|
-
eventBusInstance.get('
|
|
96
|
+
eventBusInstance.get('mark:assist-request').next({
|
|
97
97
|
motivation: 'linking',
|
|
98
98
|
options: { entityTypes: ['Location'] }
|
|
99
99
|
});
|
|
@@ -106,7 +106,7 @@ describe('Detection Progress Dismissal Bug', () => {
|
|
|
106
106
|
|
|
107
107
|
// SSE sends progress update
|
|
108
108
|
act(() => {
|
|
109
|
-
eventBusInstance.get('
|
|
109
|
+
eventBusInstance.get('mark:progress').next({
|
|
110
110
|
status: 'scanning',
|
|
111
111
|
message: 'Processing: Location',
|
|
112
112
|
currentEntityType: 'Location',
|
|
@@ -118,9 +118,9 @@ describe('Detection Progress Dismissal Bug', () => {
|
|
|
118
118
|
expect(screen.getByTestId('progress')).toHaveTextContent('Processing: Location');
|
|
119
119
|
});
|
|
120
120
|
|
|
121
|
-
// Detection completes (SSE finishes, backend emits
|
|
121
|
+
// Detection completes (SSE finishes, backend emits mark:assist-finished)
|
|
122
122
|
act(() => {
|
|
123
|
-
eventBusInstance.get('
|
|
123
|
+
eventBusInstance.get('mark:assist-finished').next({ motivation: 'linking' });
|
|
124
124
|
});
|
|
125
125
|
|
|
126
126
|
// assistingMotivation cleared immediately
|
|
@@ -138,7 +138,7 @@ describe('Detection Progress Dismissal Bug', () => {
|
|
|
138
138
|
|
|
139
139
|
function TestHarness() {
|
|
140
140
|
eventBusInstance = useEventBus();
|
|
141
|
-
const { progress } =
|
|
141
|
+
const { progress } = useMarkFlow(rUri);
|
|
142
142
|
|
|
143
143
|
return (
|
|
144
144
|
<div data-testid="progress">
|
|
@@ -159,15 +159,15 @@ describe('Detection Progress Dismissal Bug', () => {
|
|
|
159
159
|
|
|
160
160
|
// First detection with stuck progress
|
|
161
161
|
act(() => {
|
|
162
|
-
eventBusInstance.get('
|
|
162
|
+
eventBusInstance.get('mark:assist-request').next({ motivation: 'linking', options: {} });
|
|
163
163
|
});
|
|
164
164
|
|
|
165
165
|
act(() => {
|
|
166
|
-
eventBusInstance.get('
|
|
166
|
+
eventBusInstance.get('mark:progress').next({ message: 'Old progress stuck here' });
|
|
167
167
|
});
|
|
168
168
|
|
|
169
169
|
act(() => {
|
|
170
|
-
eventBusInstance.get('
|
|
170
|
+
eventBusInstance.get('mark:assist-finished').next({ motivation: 'linking' });
|
|
171
171
|
});
|
|
172
172
|
|
|
173
173
|
await waitFor(() => {
|
|
@@ -176,7 +176,7 @@ describe('Detection Progress Dismissal Bug', () => {
|
|
|
176
176
|
|
|
177
177
|
// WORKAROUND: Start new detection clears old progress
|
|
178
178
|
act(() => {
|
|
179
|
-
eventBusInstance.get('
|
|
179
|
+
eventBusInstance.get('mark:assist-request').next({ motivation: 'highlighting', options: {} });
|
|
180
180
|
});
|
|
181
181
|
|
|
182
182
|
await waitFor(() => {
|
|
@@ -191,7 +191,7 @@ describe('Detection Progress Dismissal Bug', () => {
|
|
|
191
191
|
|
|
192
192
|
function TestHarness() {
|
|
193
193
|
eventBusInstance = useEventBus();
|
|
194
|
-
const { progress } =
|
|
194
|
+
const { progress } = useMarkFlow(rUri);
|
|
195
195
|
|
|
196
196
|
return (
|
|
197
197
|
<div data-testid="progress">
|
|
@@ -212,18 +212,18 @@ describe('Detection Progress Dismissal Bug', () => {
|
|
|
212
212
|
|
|
213
213
|
// Show progress
|
|
214
214
|
act(() => {
|
|
215
|
-
eventBusInstance.get('
|
|
215
|
+
eventBusInstance.get('mark:assist-request').next({ motivation: 'linking', options: {} });
|
|
216
216
|
});
|
|
217
217
|
|
|
218
218
|
act(() => {
|
|
219
|
-
eventBusInstance.get('
|
|
219
|
+
eventBusInstance.get('mark:progress').next({
|
|
220
220
|
status: 'complete',
|
|
221
221
|
message: 'Complete! Created 5 annotations'
|
|
222
222
|
});
|
|
223
223
|
});
|
|
224
224
|
|
|
225
225
|
act(() => {
|
|
226
|
-
eventBusInstance.get('
|
|
226
|
+
eventBusInstance.get('mark:assist-finished').next({ motivation: 'linking' });
|
|
227
227
|
});
|
|
228
228
|
|
|
229
229
|
// Progress visible initially
|
|
@@ -242,7 +242,7 @@ describe('Detection Progress Dismissal Bug', () => {
|
|
|
242
242
|
it('FIXED: SSE emits final completion chunk data as annotate:assist-progress', async () => {
|
|
243
243
|
/**
|
|
244
244
|
* This test verifies that SSE emits the final chunk as annotate:assist-progress
|
|
245
|
-
* BEFORE emitting
|
|
245
|
+
* BEFORE emitting mark:assist-finished.
|
|
246
246
|
*
|
|
247
247
|
* This ensures the UI can display the final completion message with status:'complete'.
|
|
248
248
|
*/
|
|
@@ -251,7 +251,7 @@ describe('Detection Progress Dismissal Bug', () => {
|
|
|
251
251
|
|
|
252
252
|
function TestHarness() {
|
|
253
253
|
eventBusInstance = useEventBus();
|
|
254
|
-
const { progress } =
|
|
254
|
+
const { progress } = useMarkFlow(rUri);
|
|
255
255
|
|
|
256
256
|
return (
|
|
257
257
|
<div>
|
|
@@ -273,7 +273,7 @@ describe('Detection Progress Dismissal Bug', () => {
|
|
|
273
273
|
|
|
274
274
|
// Start detection (triggers SSE stream creation)
|
|
275
275
|
act(() => {
|
|
276
|
-
eventBusInstance.get('
|
|
276
|
+
eventBusInstance.get('mark:assist-request').next({
|
|
277
277
|
motivation: 'linking',
|
|
278
278
|
options: { entityTypes: ['Location'] }
|
|
279
279
|
});
|
|
@@ -281,7 +281,7 @@ describe('Detection Progress Dismissal Bug', () => {
|
|
|
281
281
|
|
|
282
282
|
// Simulate SSE scanning chunk
|
|
283
283
|
act(() => {
|
|
284
|
-
eventBusInstance.get('
|
|
284
|
+
eventBusInstance.get('mark:progress').next({
|
|
285
285
|
status: 'scanning',
|
|
286
286
|
message: 'Processing: Location',
|
|
287
287
|
});
|
|
@@ -293,7 +293,7 @@ describe('Detection Progress Dismissal Bug', () => {
|
|
|
293
293
|
|
|
294
294
|
// Simulate SSE emitting final chunk as annotate:assist-progress
|
|
295
295
|
act(() => {
|
|
296
|
-
eventBusInstance.get('
|
|
296
|
+
eventBusInstance.get('mark:progress').next({
|
|
297
297
|
status: 'complete',
|
|
298
298
|
message: 'Complete! Found 5 entities',
|
|
299
299
|
foundCount: 5,
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Layer 3: Feature Integration Test - Resolution Flow (search modal & body update)
|
|
3
3
|
*
|
|
4
|
-
* Tests the UNCOVERED half of
|
|
5
|
-
* -
|
|
6
|
-
* -
|
|
4
|
+
* Tests the UNCOVERED half of useBindFlow:
|
|
5
|
+
* - bind:link → emits bind:search-requested
|
|
6
|
+
* - bind:search-requested → opens search modal with pendingReferenceId
|
|
7
7
|
* - onCloseSearchModal → closes modal
|
|
8
|
-
* -
|
|
9
|
-
* -
|
|
10
|
-
* -
|
|
8
|
+
* - bind:update-body → calls updateAnnotationBody API
|
|
9
|
+
* - bind:update-body → emits bind:body-updated on success
|
|
10
|
+
* - bind:update-body → emits bind:body-update-failed on error
|
|
11
11
|
* - auth token passed to updateAnnotationBody
|
|
12
12
|
*
|
|
13
|
-
* The deletion half of
|
|
13
|
+
* The deletion half of useBindFlow is covered by AnnotationDeletionIntegration.test.tsx.
|
|
14
14
|
*
|
|
15
15
|
* Uses real providers (EventBus, ApiClient, AuthToken) with mocked API boundary.
|
|
16
16
|
*/
|
|
@@ -18,7 +18,7 @@
|
|
|
18
18
|
import { describe, it, expect, vi, beforeEach, afterEach } from 'vitest';
|
|
19
19
|
import { render, waitFor } from '@testing-library/react';
|
|
20
20
|
import { act } from 'react';
|
|
21
|
-
import {
|
|
21
|
+
import { useBindFlow } from '../../../hooks/useBindFlow';
|
|
22
22
|
import { EventBusProvider, useEventBus, resetEventBusForTesting } from '../../../contexts/EventBusContext';
|
|
23
23
|
import { ApiClientProvider } from '../../../contexts/ApiClientContext';
|
|
24
24
|
import { AuthTokenProvider } from '../../../contexts/AuthTokenContext';
|
|
@@ -55,13 +55,13 @@ describe('Resolution Flow - Search Modal & Body Update Integration', () => {
|
|
|
55
55
|
|
|
56
56
|
// ─── Render helper ──────────────────────────────────────────────────────────
|
|
57
57
|
|
|
58
|
-
function
|
|
58
|
+
function renderBindFlow() {
|
|
59
59
|
let eventBusInstance: ReturnType<typeof useEventBus> | null = null;
|
|
60
|
-
let lastState: ReturnType<typeof
|
|
60
|
+
let lastState: ReturnType<typeof useBindFlow> | null = null;
|
|
61
61
|
|
|
62
62
|
function TestComponent() {
|
|
63
63
|
eventBusInstance = useEventBus();
|
|
64
|
-
lastState =
|
|
64
|
+
lastState = useBindFlow(testUri);
|
|
65
65
|
return null;
|
|
66
66
|
}
|
|
67
67
|
|
|
@@ -84,19 +84,19 @@ describe('Resolution Flow - Search Modal & Body Update Integration', () => {
|
|
|
84
84
|
// ─── Initial state ──────────────────────────────────────────────────────────
|
|
85
85
|
|
|
86
86
|
it('starts with search modal closed and no pending reference', () => {
|
|
87
|
-
const { getState } =
|
|
87
|
+
const { getState } = renderBindFlow();
|
|
88
88
|
expect(getState().searchModalOpen).toBe(false);
|
|
89
89
|
expect(getState().pendingReferenceId).toBeNull();
|
|
90
90
|
});
|
|
91
91
|
|
|
92
|
-
// ───
|
|
92
|
+
// ─── bind:link ─────────────────────────────────────────────────────────
|
|
93
93
|
|
|
94
|
-
it('
|
|
95
|
-
const { getEventBus } =
|
|
94
|
+
it('bind:link emits bind:search-requested with referenceId and searchTerm', () => {
|
|
95
|
+
const { getEventBus } = renderBindFlow();
|
|
96
96
|
const searchRequestedSpy = vi.fn();
|
|
97
97
|
|
|
98
|
-
const subscription = getEventBus().get('
|
|
99
|
-
act(() => { getEventBus().get('
|
|
98
|
+
const subscription = getEventBus().get('bind:search-requested').subscribe(searchRequestedSpy);
|
|
99
|
+
act(() => { getEventBus().get('bind:link').next({ annotationUri: 'ann-uri-123', searchTerm: 'climate change' }); });
|
|
100
100
|
subscription.unsubscribe();
|
|
101
101
|
|
|
102
102
|
expect(searchRequestedSpy).toHaveBeenCalledTimes(1);
|
|
@@ -106,35 +106,35 @@ describe('Resolution Flow - Search Modal & Body Update Integration', () => {
|
|
|
106
106
|
});
|
|
107
107
|
});
|
|
108
108
|
|
|
109
|
-
// ───
|
|
109
|
+
// ─── bind:search-requested ────────────────────────────────────────────
|
|
110
110
|
|
|
111
|
-
it('
|
|
112
|
-
const { getState, getEventBus } =
|
|
111
|
+
it('bind:search-requested opens the search modal', async () => {
|
|
112
|
+
const { getState, getEventBus } = renderBindFlow();
|
|
113
113
|
|
|
114
114
|
expect(getState().searchModalOpen).toBe(false);
|
|
115
115
|
|
|
116
|
-
act(() => { getEventBus().get('
|
|
116
|
+
act(() => { getEventBus().get('bind:search-requested').next({ referenceId: 'ref-abc', searchTerm: 'oceans' }); });
|
|
117
117
|
|
|
118
118
|
await waitFor(() => {
|
|
119
119
|
expect(getState().searchModalOpen).toBe(true);
|
|
120
120
|
});
|
|
121
121
|
});
|
|
122
122
|
|
|
123
|
-
it('
|
|
124
|
-
const { getState, getEventBus } =
|
|
123
|
+
it('bind:search-requested sets pendingReferenceId', async () => {
|
|
124
|
+
const { getState, getEventBus } = renderBindFlow();
|
|
125
125
|
|
|
126
|
-
act(() => { getEventBus().get('
|
|
126
|
+
act(() => { getEventBus().get('bind:search-requested').next({ referenceId: 'ref-xyz', searchTerm: 'forests' }); });
|
|
127
127
|
|
|
128
128
|
await waitFor(() => {
|
|
129
129
|
expect(getState().pendingReferenceId).toBe('ref-xyz');
|
|
130
130
|
});
|
|
131
131
|
});
|
|
132
132
|
|
|
133
|
-
it('
|
|
134
|
-
const { getState, getEventBus } =
|
|
133
|
+
it('bind:link → bind:search-requested chain opens modal end-to-end', async () => {
|
|
134
|
+
const { getState, getEventBus } = renderBindFlow();
|
|
135
135
|
|
|
136
136
|
// Simulate the full user journey: user clicks "Link Document" on a reference entry
|
|
137
|
-
act(() => { getEventBus().get('
|
|
137
|
+
act(() => { getEventBus().get('bind:link').next({ annotationUri: 'ann-full-chain', searchTerm: 'biodiversity' }); });
|
|
138
138
|
|
|
139
139
|
await waitFor(() => {
|
|
140
140
|
expect(getState().searchModalOpen).toBe(true);
|
|
@@ -145,9 +145,9 @@ describe('Resolution Flow - Search Modal & Body Update Integration', () => {
|
|
|
145
145
|
// ─── onCloseSearchModal ──────────────────────────────────────────────────────
|
|
146
146
|
|
|
147
147
|
it('onCloseSearchModal closes the search modal', async () => {
|
|
148
|
-
const { getState, getEventBus } =
|
|
148
|
+
const { getState, getEventBus } = renderBindFlow();
|
|
149
149
|
|
|
150
|
-
act(() => { getEventBus().get('
|
|
150
|
+
act(() => { getEventBus().get('bind:search-requested').next({ referenceId: 'ref-close', searchTerm: 'test' }); });
|
|
151
151
|
|
|
152
152
|
await waitFor(() => expect(getState().searchModalOpen).toBe(true));
|
|
153
153
|
|
|
@@ -159,9 +159,9 @@ describe('Resolution Flow - Search Modal & Body Update Integration', () => {
|
|
|
159
159
|
});
|
|
160
160
|
|
|
161
161
|
it('onCloseSearchModal does not clear pendingReferenceId (preserves for re-open)', async () => {
|
|
162
|
-
const { getState, getEventBus } =
|
|
162
|
+
const { getState, getEventBus } = renderBindFlow();
|
|
163
163
|
|
|
164
|
-
act(() => { getEventBus().get('
|
|
164
|
+
act(() => { getEventBus().get('bind:search-requested').next({ referenceId: 'ref-persist', searchTerm: 'test' }); });
|
|
165
165
|
await waitFor(() => expect(getState().searchModalOpen).toBe(true));
|
|
166
166
|
|
|
167
167
|
act(() => { getState().onCloseSearchModal(); });
|
|
@@ -171,12 +171,12 @@ describe('Resolution Flow - Search Modal & Body Update Integration', () => {
|
|
|
171
171
|
expect(getState().pendingReferenceId).toBe('ref-persist');
|
|
172
172
|
});
|
|
173
173
|
|
|
174
|
-
// ───
|
|
174
|
+
// ─── bind:update-body ──────────────────────────────────────────────────
|
|
175
175
|
|
|
176
|
-
it('
|
|
177
|
-
const { getEventBus } =
|
|
176
|
+
it('bind:update-body calls updateAnnotationBody API', async () => {
|
|
177
|
+
const { getEventBus } = renderBindFlow();
|
|
178
178
|
|
|
179
|
-
act(() => { getEventBus().get('
|
|
179
|
+
act(() => { getEventBus().get('bind:update-body').next({
|
|
180
180
|
annotationUri: 'http://localhost:4000/resources/test-resource/annotations/ann-body-1',
|
|
181
181
|
resourceId: 'linked-resource-id',
|
|
182
182
|
operations: [{ op: 'add', item: { id: 'linked-resource-id' } }],
|
|
@@ -187,10 +187,10 @@ describe('Resolution Flow - Search Modal & Body Update Integration', () => {
|
|
|
187
187
|
});
|
|
188
188
|
});
|
|
189
189
|
|
|
190
|
-
it('
|
|
191
|
-
const { getEventBus } =
|
|
190
|
+
it('bind:update-body passes auth token to API call', async () => {
|
|
191
|
+
const { getEventBus } = renderBindFlow();
|
|
192
192
|
|
|
193
|
-
act(() => { getEventBus().get('
|
|
193
|
+
act(() => { getEventBus().get('bind:update-body').next({
|
|
194
194
|
annotationUri: 'http://localhost:4000/resources/test-resource/annotations/ann-auth',
|
|
195
195
|
resourceId: 'resource-id',
|
|
196
196
|
operations: [{ op: 'replace', newItem: { id: 'resource-id' } }],
|
|
@@ -205,13 +205,13 @@ describe('Resolution Flow - Search Modal & Body Update Integration', () => {
|
|
|
205
205
|
expect(callArgs[2].auth).toBe(accessToken(testToken));
|
|
206
206
|
});
|
|
207
207
|
|
|
208
|
-
it('
|
|
209
|
-
const { getEventBus } =
|
|
208
|
+
it('bind:update-body emits bind:body-updated on success', async () => {
|
|
209
|
+
const { getEventBus } = renderBindFlow();
|
|
210
210
|
const bodyUpdatedSpy = vi.fn();
|
|
211
211
|
|
|
212
|
-
const subscription = getEventBus().get('
|
|
212
|
+
const subscription = getEventBus().get('bind:body-updated').subscribe(bodyUpdatedSpy);
|
|
213
213
|
|
|
214
|
-
act(() => { getEventBus().get('
|
|
214
|
+
act(() => { getEventBus().get('bind:update-body').next({
|
|
215
215
|
annotationUri: 'http://localhost:4000/resources/test-resource/annotations/ann-success',
|
|
216
216
|
resourceId: 'resource-id',
|
|
217
217
|
operations: [{ op: 'add', item: { id: 'resource-id' } }],
|
|
@@ -228,15 +228,15 @@ describe('Resolution Flow - Search Modal & Body Update Integration', () => {
|
|
|
228
228
|
});
|
|
229
229
|
});
|
|
230
230
|
|
|
231
|
-
it('
|
|
231
|
+
it('bind:update-body emits bind:body-update-failed on API error', async () => {
|
|
232
232
|
updateAnnotationBodySpy.mockRejectedValue(new Error('Update failed'));
|
|
233
233
|
|
|
234
|
-
const { getEventBus } =
|
|
234
|
+
const { getEventBus } = renderBindFlow();
|
|
235
235
|
const bodyUpdateFailedSpy = vi.fn();
|
|
236
236
|
|
|
237
|
-
const subscription = getEventBus().get('
|
|
237
|
+
const subscription = getEventBus().get('bind:body-update-failed').subscribe(bodyUpdateFailedSpy);
|
|
238
238
|
|
|
239
|
-
act(() => { getEventBus().get('
|
|
239
|
+
act(() => { getEventBus().get('bind:update-body').next({
|
|
240
240
|
annotationUri: 'http://localhost:4000/resources/test-resource/annotations/ann-fail',
|
|
241
241
|
resourceId: 'resource-id',
|
|
242
242
|
operations: [{ op: 'remove', item: { id: 'old-id' } }],
|
|
@@ -253,10 +253,10 @@ describe('Resolution Flow - Search Modal & Body Update Integration', () => {
|
|
|
253
253
|
});
|
|
254
254
|
});
|
|
255
255
|
|
|
256
|
-
it('
|
|
257
|
-
const { getEventBus } =
|
|
256
|
+
it('bind:update-body called ONCE — no duplicate subscriptions', async () => {
|
|
257
|
+
const { getEventBus } = renderBindFlow();
|
|
258
258
|
|
|
259
|
-
act(() => { getEventBus().get('
|
|
259
|
+
act(() => { getEventBus().get('bind:update-body').next({
|
|
260
260
|
annotationUri: 'http://localhost:4000/resources/test-resource/annotations/ann-dedup',
|
|
261
261
|
resourceId: 'resource-id',
|
|
262
262
|
operations: [{ op: 'add', item: { id: 'resource-id' } }],
|
|
@@ -2,18 +2,18 @@
|
|
|
2
2
|
* FAILING TEST: Reproduces the bug where detection events fire but state doesn't update
|
|
3
3
|
*
|
|
4
4
|
* Based on console logs from production:
|
|
5
|
-
* ✅
|
|
5
|
+
* ✅ mark:assist-request emitted
|
|
6
6
|
* ✅ annotate:assist-progress emitted
|
|
7
7
|
* ❌ assistingMotivation remains null
|
|
8
8
|
* ❌ progress remains null
|
|
9
9
|
*
|
|
10
|
-
* UPDATED: Now tests
|
|
10
|
+
* UPDATED: Now tests useMarkFlow hook instead of DetectionFlowContainer
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
14
14
|
import { render, screen, waitFor } from '@testing-library/react';
|
|
15
15
|
import { act } from 'react';
|
|
16
|
-
import {
|
|
16
|
+
import { useMarkFlow } from '../../../hooks/useMarkFlow';
|
|
17
17
|
import { EventBusProvider, useEventBus, resetEventBusForTesting } from '../../../contexts/EventBusContext';
|
|
18
18
|
import { ApiClientProvider } from '../../../contexts/ApiClientContext';
|
|
19
19
|
import { AuthTokenProvider } from '../../../contexts/AuthTokenContext';
|
|
@@ -45,17 +45,17 @@ describe('REPRODUCING BUG: Detection state not updating', () => {
|
|
|
45
45
|
vi.restoreAllMocks();
|
|
46
46
|
});
|
|
47
47
|
|
|
48
|
-
it('SHOULD update state when
|
|
48
|
+
it('SHOULD update state when mark:assist-request event is emitted', async () => {
|
|
49
49
|
let eventBusInstance: any;
|
|
50
50
|
let currentState: any;
|
|
51
51
|
|
|
52
52
|
// Component to capture EventBus and hook state
|
|
53
53
|
function TestComponent() {
|
|
54
54
|
eventBusInstance = useEventBus();
|
|
55
|
-
const state =
|
|
55
|
+
const state = useMarkFlow('http://localhost:8080/resources/test' as any);
|
|
56
56
|
currentState = state;
|
|
57
57
|
|
|
58
|
-
console.log('[TEST]
|
|
58
|
+
console.log('[TEST] useMarkFlow state:', {
|
|
59
59
|
assistingMotivation: state.assistingMotivation,
|
|
60
60
|
progress: state.progress,
|
|
61
61
|
});
|
|
@@ -82,17 +82,17 @@ describe('REPRODUCING BUG: Detection state not updating', () => {
|
|
|
82
82
|
expect(screen.getByTestId('detecting')).toHaveTextContent('null');
|
|
83
83
|
expect(screen.getByTestId('progress')).toHaveTextContent('null');
|
|
84
84
|
|
|
85
|
-
console.log('[TEST] Emitting
|
|
85
|
+
console.log('[TEST] Emitting mark:assist-request event...');
|
|
86
86
|
|
|
87
|
-
// Emit
|
|
87
|
+
// Emit mark:assist-request event (exactly like production)
|
|
88
88
|
act(() => {
|
|
89
|
-
eventBusInstance.get('
|
|
89
|
+
eventBusInstance.get('mark:assist-request').next({
|
|
90
90
|
motivation: 'linking',
|
|
91
91
|
options: { entityTypes: ['Location'] }
|
|
92
92
|
});
|
|
93
93
|
});
|
|
94
94
|
|
|
95
|
-
console.log('[TEST] After
|
|
95
|
+
console.log('[TEST] After mark:assist-request, checking state...');
|
|
96
96
|
|
|
97
97
|
// THIS SHOULD PASS but currently FAILS
|
|
98
98
|
await waitFor(() => {
|
|
@@ -109,7 +109,7 @@ describe('REPRODUCING BUG: Detection state not updating', () => {
|
|
|
109
109
|
|
|
110
110
|
function TestComponent() {
|
|
111
111
|
eventBusInstance = useEventBus();
|
|
112
|
-
const state =
|
|
112
|
+
const state = useMarkFlow('http://localhost:8080/resources/test' as any);
|
|
113
113
|
currentState = state;
|
|
114
114
|
|
|
115
115
|
return (
|
|
@@ -134,7 +134,7 @@ describe('REPRODUCING BUG: Detection state not updating', () => {
|
|
|
134
134
|
|
|
135
135
|
// Emit annotate:assist-progress event (exactly like production)
|
|
136
136
|
act(() => {
|
|
137
|
-
eventBusInstance.get('
|
|
137
|
+
eventBusInstance.get('mark:progress').next({
|
|
138
138
|
status: 'started',
|
|
139
139
|
resourceId: 'test',
|
|
140
140
|
totalEntityTypes: 1,
|
|
@@ -162,7 +162,7 @@ describe('REPRODUCING BUG: Detection state not updating', () => {
|
|
|
162
162
|
|
|
163
163
|
function TestComponent() {
|
|
164
164
|
eventBusInstance = useEventBus();
|
|
165
|
-
const state =
|
|
165
|
+
const state = useMarkFlow('http://localhost:8080/resources/f45fd44f9cb0b0fe1b7980d3d034bc61' as any);
|
|
166
166
|
|
|
167
167
|
stateSnapshots.push({
|
|
168
168
|
assistingMotivation: state.assistingMotivation,
|
|
@@ -192,18 +192,18 @@ describe('REPRODUCING BUG: Detection state not updating', () => {
|
|
|
192
192
|
|
|
193
193
|
// Exactly like production logs
|
|
194
194
|
act(() => {
|
|
195
|
-
console.log('[EventBus] emit:
|
|
196
|
-
eventBusInstance.get('
|
|
195
|
+
console.log('[EventBus] emit: mark:assist-request {motivation: "linking", options: {...}}');
|
|
196
|
+
eventBusInstance.get('mark:assist-request').next({
|
|
197
197
|
motivation: 'linking',
|
|
198
198
|
options: { entityTypes: ['Location'] }
|
|
199
199
|
});
|
|
200
200
|
});
|
|
201
201
|
|
|
202
|
-
console.log('After
|
|
202
|
+
console.log('After mark:assist-request:', stateSnapshots[stateSnapshots.length - 1]);
|
|
203
203
|
|
|
204
204
|
act(() => {
|
|
205
205
|
console.log('[EventBus] emit: annotate:assist-progress {status: "started", ...}');
|
|
206
|
-
eventBusInstance.get('
|
|
206
|
+
eventBusInstance.get('mark:progress').next({
|
|
207
207
|
status: 'started',
|
|
208
208
|
resourceId: 'f45fd44f9cb0b0fe1b7980d3d034bc61',
|
|
209
209
|
totalEntityTypes: 1,
|
|
@@ -216,7 +216,7 @@ describe('REPRODUCING BUG: Detection state not updating', () => {
|
|
|
216
216
|
|
|
217
217
|
act(() => {
|
|
218
218
|
console.log('[EventBus] emit: annotate:assist-progress {status: "scanning", ...}');
|
|
219
|
-
eventBusInstance.get('
|
|
219
|
+
eventBusInstance.get('mark:progress').next({
|
|
220
220
|
status: 'scanning',
|
|
221
221
|
resourceId: 'f45fd44f9cb0b0fe1b7980d3d034bc61',
|
|
222
222
|
currentEntityType: 'Location',
|