@semiont/react-ui 0.5.5 → 0.5.7
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/README.md +59 -55
- package/dist/{PdfAnnotationCanvas.client-CN3C3S55.js → PdfAnnotationCanvas.client-NIMALXNZ.js} +7 -27
- package/dist/PdfAnnotationCanvas.client-NIMALXNZ.js.map +1 -0
- package/dist/{ar-U2EXWUMQ.js → ar-SONK6MON.js} +3 -7
- package/dist/ar-SONK6MON.js.map +1 -0
- package/dist/{bn-DRJGV772.js → bn-ZKPRITNG.js} +3 -7
- package/dist/bn-ZKPRITNG.js.map +1 -0
- package/dist/{chunk-3Q3TUKWP.js → chunk-Y2EEAOMZ.js} +29 -29
- package/dist/{cs-PTWDM23V.js → cs-LPXQ7NHQ.js} +3 -7
- package/dist/cs-LPXQ7NHQ.js.map +1 -0
- package/dist/{da-KSNIKYSS.js → da-6TKY7MCY.js} +6 -10
- package/dist/da-6TKY7MCY.js.map +1 -0
- package/dist/{de-F2XBEWFY.js → de-C3GNII74.js} +3 -7
- package/dist/de-C3GNII74.js.map +1 -0
- package/dist/{el-DLD2GWAP.js → el-UBCXQDJ7.js} +3 -7
- package/dist/el-UBCXQDJ7.js.map +1 -0
- package/dist/{es-WLPYWGB5.js → es-BQ23TRI7.js} +11 -15
- package/dist/es-BQ23TRI7.js.map +1 -0
- package/dist/{fa-BAXHSDZG.js → fa-AFTBZB77.js} +3 -7
- package/dist/fa-AFTBZB77.js.map +1 -0
- package/dist/{fi-FCHSYVOT.js → fi-WOYNLZC2.js} +3 -7
- package/dist/fi-WOYNLZC2.js.map +1 -0
- package/dist/{fr-3UERBSL6.js → fr-NDSMIFJM.js} +3 -7
- package/dist/fr-NDSMIFJM.js.map +1 -0
- package/dist/{he-F6F3FV2K.js → he-VJXVRDOY.js} +3 -7
- package/dist/he-VJXVRDOY.js.map +1 -0
- package/dist/{hi-4BK6IK7Q.js → hi-BF6PHIE2.js} +3 -7
- package/dist/hi-BF6PHIE2.js.map +1 -0
- package/dist/{id-7ECCWP3J.js → id-GXG5QCZY.js} +3 -7
- package/dist/id-GXG5QCZY.js.map +1 -0
- package/dist/index.css +103 -0
- package/dist/index.css.map +1 -1
- package/dist/index.d.ts +271 -120
- package/dist/index.js +877 -698
- package/dist/index.js.map +1 -1
- package/dist/{it-234Z6XK6.js → it-XKHHCBAF.js} +3 -7
- package/dist/it-XKHHCBAF.js.map +1 -0
- package/dist/{ja-PJWQI4OQ.js → ja-TX7VM4XD.js} +3 -7
- package/dist/ja-TX7VM4XD.js.map +1 -0
- package/dist/{ko-APUEW2RS.js → ko-DNC7EQ7J.js} +3 -7
- package/dist/ko-DNC7EQ7J.js.map +1 -0
- package/dist/{ms-PJBZWZWD.js → ms-POZGBKPH.js} +3 -7
- package/dist/ms-POZGBKPH.js.map +1 -0
- package/dist/{nl-L4C3ZBCU.js → nl-IRMTKI7Z.js} +4 -11
- package/dist/nl-IRMTKI7Z.js.map +1 -0
- package/dist/{no-QE5N5KNG.js → no-ZUDJA4S6.js} +20 -24
- package/dist/no-ZUDJA4S6.js.map +1 -0
- package/dist/{pl-5Q2D23PD.js → pl-2NGAXL5U.js} +3 -7
- package/dist/pl-2NGAXL5U.js.map +1 -0
- package/dist/{pt-AIGUOIOC.js → pt-ABMCXZUM.js} +118 -122
- package/dist/pt-ABMCXZUM.js.map +1 -0
- package/dist/{ro-T56CSHTY.js → ro-VOJP6O5X.js} +3 -7
- package/dist/ro-VOJP6O5X.js.map +1 -0
- package/dist/{sv-L4TJQ2UH.js → sv-4HVFIIE5.js} +43 -47
- package/dist/sv-4HVFIIE5.js.map +1 -0
- package/dist/test-utils.js +2 -2
- package/dist/test-utils.js.map +1 -1
- package/dist/{th-6O7Y6O2Q.js → th-IFPZP3HQ.js} +3 -7
- package/dist/th-IFPZP3HQ.js.map +1 -0
- package/dist/{tr-D4CQCSNO.js → tr-2GYEAMJ4.js} +3 -7
- package/dist/tr-2GYEAMJ4.js.map +1 -0
- package/dist/{uk-2HMQG6ND.js → uk-XCJBVLLD.js} +3 -7
- package/dist/uk-XCJBVLLD.js.map +1 -0
- package/dist/{vi-XVJ4RUEJ.js → vi-4FR7CB2F.js} +3 -7
- package/dist/vi-4FR7CB2F.js.map +1 -0
- package/dist/{zh-K2KDPGHK.js → zh-NSKFOINB.js} +3 -7
- package/dist/zh-NSKFOINB.js.map +1 -0
- package/package.json +17 -13
- package/src/components/Button/__tests__/Button.test.tsx +0 -2
- package/src/components/CodeMirrorRenderer.tsx +2 -0
- package/src/components/ErrorBoundary.tsx +0 -9
- package/src/components/ProtectedErrorBoundary.css +119 -0
- package/src/components/ProtectedErrorBoundary.tsx +24 -15
- package/src/components/__tests__/AnnotateReferencesProgressWidget.test.tsx +0 -1
- package/src/components/__tests__/ErrorBoundary.test.tsx +20 -13
- package/src/components/__tests__/LiveRegion.hooks.test.tsx +1 -1
- package/src/components/__tests__/ProtectedErrorBoundary.test.tsx +2 -1
- package/src/components/__tests__/ResizeHandle.test.tsx +0 -1
- package/src/components/__tests__/SessionExpiryBanner.test.tsx +0 -1
- package/src/components/__tests__/StatusDisplay.test.tsx +0 -1
- package/src/components/__tests__/Toast.test.tsx +2 -3
- package/src/components/__tests__/Toolbar.test.tsx +0 -1
- package/src/components/annotation/annotations.css +14 -0
- package/src/components/annotation-popups/__tests__/JsonLdView.test.tsx +3 -5
- package/src/components/annotation-popups/__tests__/SharedPopupElements.test.tsx +0 -1
- package/src/components/branding/__tests__/SemiontBranding.test.tsx +1 -2
- package/src/components/layout/__tests__/LeftSidebar.test.tsx +5 -6
- package/src/components/layout/__tests__/PageLayout.test.tsx +1 -3
- package/src/components/layout/__tests__/SkipLinks.a11y.test.tsx +8 -8
- package/src/components/layout/__tests__/UnifiedHeader.test.tsx +12 -1
- package/src/components/modals/__tests__/KeyboardShortcutsHelpModal.test.tsx +0 -1
- package/src/components/modals/__tests__/PermissionDeniedModal.test.tsx +3 -4
- package/src/components/modals/__tests__/ResourceSearchModal.test.tsx +1 -2
- package/src/components/modals/__tests__/SearchModal.basic.test.tsx +1 -1
- package/src/components/modals/__tests__/SearchModal.keyboard.test.tsx +0 -5
- package/src/components/modals/__tests__/SearchModal.search-wiring.test.tsx +1 -2
- package/src/components/modals/__tests__/SearchModal.visual.test.tsx +2 -2
- package/src/components/modals/__tests__/SessionExpiredModal.test.tsx +0 -1
- package/src/components/navigation/NavigationMenu.tsx +1 -1
- package/src/components/navigation/__tests__/Footer.a11y.test.tsx +4 -0
- package/src/components/navigation/__tests__/Footer.test.tsx +3 -6
- package/src/components/navigation/__tests__/NavigationMenu.a11y.test.tsx +1 -1
- package/src/components/navigation/__tests__/NavigationMenu.test.tsx +7 -9
- package/src/components/navigation/__tests__/ObservableLink.test.tsx +0 -1
- package/src/components/navigation/__tests__/SimpleNavigation.test.tsx +1 -2
- package/src/components/navigation/__tests__/SortableResourceTab.test.tsx +0 -1
- package/src/components/pdf-annotation/PdfAnnotationCanvas.tsx +6 -4
- package/src/components/pdf-annotation/__tests__/PdfAnnotationCanvas.test.tsx +10 -19
- package/src/components/resource/AnnotateView.tsx +35 -37
- package/src/components/resource/BrowseView.tsx +31 -31
- package/src/components/resource/__tests__/AnnotationHistory.test.tsx +0 -1
- package/src/components/resource/__tests__/BrowseView.test.tsx +12 -14
- package/src/components/resource/__tests__/HistoryEvent.test.tsx +0 -5
- package/src/components/resource/__tests__/ResourceViewer.mode-switch.test.tsx +4 -6
- package/src/components/resource/__tests__/event-formatting.test.ts +1 -1
- package/src/components/resource/panels/CollaborationPanel.tsx +1 -1
- package/src/components/resource/panels/JsonLdPanel.tsx +33 -16
- package/src/components/resource/panels/ReferencesPanel.tsx +1 -1
- package/src/components/resource/panels/__tests__/AssessmentEntry.test.tsx +4 -5
- package/src/components/resource/panels/__tests__/AssessmentPanel.test.tsx +8 -7
- package/src/components/resource/panels/__tests__/AssistSection.test.tsx +14 -10
- package/src/components/resource/panels/__tests__/CollaborationPanel.test.tsx +0 -1
- package/src/components/resource/panels/__tests__/CommentEntry.test.tsx +31 -18
- package/src/components/resource/panels/__tests__/CommentsPanel.test.tsx +7 -6
- package/src/components/resource/panels/__tests__/HighlightEntry.test.tsx +5 -6
- package/src/components/resource/panels/__tests__/HighlightPanel.annotationProgress.test.tsx +19 -13
- package/src/components/resource/panels/__tests__/JsonLdPanel.test.tsx +95 -426
- package/src/components/resource/panels/__tests__/PanelHeader.test.tsx +0 -1
- package/src/components/resource/panels/__tests__/ReferenceEntry.test.tsx +5 -5
- package/src/components/resource/panels/__tests__/ReferencesPanel.test.tsx +40 -7
- package/src/components/resource/panels/__tests__/ResourceInfoPanel.test.tsx +4 -4
- package/src/components/resource/panels/__tests__/StatisticsPanel.test.tsx +30 -32
- package/src/components/resource/panels/__tests__/TagEntry.test.tsx +6 -6
- package/src/components/resource/panels/__tests__/TaggingPanel.test.tsx +7 -6
- package/src/components/settings/__tests__/SettingsPanel.test.tsx +0 -1
- package/src/components/viewers/__tests__/ImageViewer.test.tsx +0 -1
- package/src/features/admin-exchange/__tests__/AdminExchangePage.test.tsx +7 -10
- package/src/features/admin-exchange/__tests__/ImportProgress.test.tsx +38 -27
- package/src/features/admin-exchange/components/ImportProgress.tsx +28 -34
- package/src/features/auth/__tests__/SignInForm.a11y.test.tsx +2 -0
- package/src/features/auth/__tests__/SignUpForm.a11y.test.tsx +11 -12
- package/src/features/auth/__tests__/SignUpForm.test.tsx +3 -3
- package/src/features/moderate-tag-schemas/components/TagSchemasPage.tsx +1 -0
- package/src/features/moderation-linked-data/__tests__/LinkedDataPage.test.tsx +11 -9
- package/src/features/resource-compose/__tests__/ResourceComposePage.test.tsx +2 -1
- package/src/features/resource-compose/components/ResourceComposePage.tsx +36 -9
- package/src/features/resource-compose/state/compose-page-state-unit.ts +5 -8
- package/src/features/resource-discovery/__tests__/ResourceCard.test.tsx +0 -1
- package/src/features/resource-discovery/__tests__/ResourceDiscoveryPage.test.tsx +33 -35
- package/src/features/resource-discovery/components/ResourceDiscoveryPage.tsx +12 -11
- package/src/features/resource-discovery/state/__tests__/discover-state-unit.test.ts +204 -11
- package/src/features/resource-discovery/state/discover-state-unit.ts +70 -11
- package/src/features/resource-viewer/__tests__/ResourceViewerPage.test.tsx +2 -2
- package/src/features/resource-viewer/components/ResourceViewerPage.tsx +10 -7
- package/src/features/resource-viewer/state/__tests__/resource-viewer-page-state-unit.test.ts +37 -1
- package/src/features/resource-viewer/state/resource-viewer-page-state-unit.ts +14 -7
- package/src/integrations/__tests__/css-modules-helper.test.tsx +2 -3
- package/src/integrations/__tests__/styled-components-theme.test.ts +1 -3
- package/src/styles/features/exchange.css +0 -30
- package/src/styles/index.css +1 -0
- package/translations/ar.json +1 -3
- package/translations/bn.json +1 -3
- package/translations/cs.json +1 -3
- package/translations/da.json +4 -6
- package/translations/de.json +1 -3
- package/translations/el.json +1 -3
- package/translations/es.json +9 -11
- package/translations/fa.json +1 -3
- package/translations/fi.json +1 -3
- package/translations/fr.json +1 -3
- package/translations/he.json +1 -3
- package/translations/hi.json +1 -3
- package/translations/id.json +1 -3
- package/translations/it.json +1 -3
- package/translations/ja.json +1 -3
- package/translations/ko.json +1 -3
- package/translations/ms.json +1 -3
- package/translations/nl.json +2 -7
- package/translations/no.json +18 -20
- package/translations/pl.json +1 -3
- package/translations/pt.json +116 -118
- package/translations/ro.json +1 -3
- package/translations/sv.json +41 -43
- package/translations/th.json +1 -3
- package/translations/tr.json +1 -3
- package/translations/uk.json +1 -3
- package/translations/vi.json +1 -3
- package/translations/zh.json +1 -3
- package/dist/PdfAnnotationCanvas.client-CN3C3S55.js.map +0 -1
- package/dist/ar-U2EXWUMQ.js.map +0 -1
- package/dist/bn-DRJGV772.js.map +0 -1
- package/dist/cs-PTWDM23V.js.map +0 -1
- package/dist/da-KSNIKYSS.js.map +0 -1
- package/dist/de-F2XBEWFY.js.map +0 -1
- package/dist/el-DLD2GWAP.js.map +0 -1
- package/dist/es-WLPYWGB5.js.map +0 -1
- package/dist/fa-BAXHSDZG.js.map +0 -1
- package/dist/fi-FCHSYVOT.js.map +0 -1
- package/dist/fr-3UERBSL6.js.map +0 -1
- package/dist/he-F6F3FV2K.js.map +0 -1
- package/dist/hi-4BK6IK7Q.js.map +0 -1
- package/dist/id-7ECCWP3J.js.map +0 -1
- package/dist/it-234Z6XK6.js.map +0 -1
- package/dist/ja-PJWQI4OQ.js.map +0 -1
- package/dist/ko-APUEW2RS.js.map +0 -1
- package/dist/ms-PJBZWZWD.js.map +0 -1
- package/dist/nl-L4C3ZBCU.js.map +0 -1
- package/dist/no-QE5N5KNG.js.map +0 -1
- package/dist/pl-5Q2D23PD.js.map +0 -1
- package/dist/pt-AIGUOIOC.js.map +0 -1
- package/dist/ro-T56CSHTY.js.map +0 -1
- package/dist/sv-L4TJQ2UH.js.map +0 -1
- package/dist/th-6O7Y6O2Q.js.map +0 -1
- package/dist/tr-D4CQCSNO.js.map +0 -1
- package/dist/uk-2HMQG6ND.js.map +0 -1
- package/dist/vi-XVJ4RUEJ.js.map +0 -1
- package/dist/zh-K2KDPGHK.js.map +0 -1
- /package/dist/{chunk-3Q3TUKWP.js.map → chunk-Y2EEAOMZ.js.map} +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
2
2
|
import React from 'react';
|
|
3
|
-
import { render, screen,
|
|
3
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
4
4
|
import userEvent from '@testing-library/user-event';
|
|
5
5
|
import '@testing-library/jest-dom';
|
|
6
6
|
import { ReferencesPanel } from '../ReferencesPanel';
|
|
@@ -316,7 +316,7 @@ describe('ReferencesPanel Component', () => {
|
|
|
316
316
|
<ReferencesPanel
|
|
317
317
|
{...defaultProps}
|
|
318
318
|
isAssisting={true}
|
|
319
|
-
progress={{ completedEntityTypes: [] }}
|
|
319
|
+
progress={{ stage: 'analyzing', percentage: 0, message: 'Detecting references...', completedEntityTypes: [] }}
|
|
320
320
|
/>
|
|
321
321
|
);
|
|
322
322
|
|
|
@@ -326,6 +326,9 @@ describe('ReferencesPanel Component', () => {
|
|
|
326
326
|
{...defaultProps}
|
|
327
327
|
isAssisting={false}
|
|
328
328
|
progress={{
|
|
329
|
+
stage: 'complete',
|
|
330
|
+
percentage: 100,
|
|
331
|
+
message: 'Annotation complete',
|
|
329
332
|
completedEntityTypes: [{ entityType: 'Person', foundCount: 5 }],
|
|
330
333
|
}}
|
|
331
334
|
/>
|
|
@@ -366,7 +369,7 @@ describe('ReferencesPanel Component', () => {
|
|
|
366
369
|
<ReferencesPanel
|
|
367
370
|
{...defaultProps}
|
|
368
371
|
isAssisting={true}
|
|
369
|
-
progress={{ completedEntityTypes: [] }}
|
|
372
|
+
progress={{ stage: 'analyzing', percentage: 0, message: 'Detecting references...', completedEntityTypes: [] }}
|
|
370
373
|
/>
|
|
371
374
|
);
|
|
372
375
|
|
|
@@ -375,6 +378,9 @@ describe('ReferencesPanel Component', () => {
|
|
|
375
378
|
|
|
376
379
|
it('should pass progress data to widget', () => {
|
|
377
380
|
const progress = {
|
|
381
|
+
stage: 'complete',
|
|
382
|
+
percentage: 100,
|
|
383
|
+
message: 'Annotation complete',
|
|
378
384
|
completedEntityTypes: [
|
|
379
385
|
{ entityType: 'Person', foundCount: 5 },
|
|
380
386
|
{ entityType: 'Organization', foundCount: 3 },
|
|
@@ -399,7 +405,7 @@ describe('ReferencesPanel Component', () => {
|
|
|
399
405
|
<ReferencesPanel
|
|
400
406
|
{...defaultProps}
|
|
401
407
|
isAssisting={true}
|
|
402
|
-
progress={{ completedEntityTypes: [] }}
|
|
408
|
+
progress={{ stage: 'analyzing', percentage: 0, message: 'Detecting references...', completedEntityTypes: [] }}
|
|
403
409
|
/>
|
|
404
410
|
);
|
|
405
411
|
|
|
@@ -412,7 +418,7 @@ describe('ReferencesPanel Component', () => {
|
|
|
412
418
|
<ReferencesPanel
|
|
413
419
|
{...defaultProps}
|
|
414
420
|
isAssisting={true}
|
|
415
|
-
progress={{ completedEntityTypes: [] }}
|
|
421
|
+
progress={{ stage: 'analyzing', percentage: 0, message: 'Detecting references...', completedEntityTypes: [] }}
|
|
416
422
|
/>
|
|
417
423
|
);
|
|
418
424
|
|
|
@@ -428,6 +434,9 @@ describe('ReferencesPanel Component', () => {
|
|
|
428
434
|
{...defaultProps}
|
|
429
435
|
isAssisting={false}
|
|
430
436
|
progress={{
|
|
437
|
+
stage: 'complete',
|
|
438
|
+
percentage: 100,
|
|
439
|
+
message: 'Annotation complete',
|
|
431
440
|
completedEntityTypes: [
|
|
432
441
|
{ entityType: 'Person', foundCount: 5 },
|
|
433
442
|
{ entityType: 'Organization', foundCount: 3 },
|
|
@@ -455,6 +464,9 @@ describe('ReferencesPanel Component', () => {
|
|
|
455
464
|
{...defaultProps}
|
|
456
465
|
isAssisting={false}
|
|
457
466
|
progress={{
|
|
467
|
+
stage: 'complete',
|
|
468
|
+
percentage: 100,
|
|
469
|
+
message: 'Annotation complete',
|
|
458
470
|
completedEntityTypes: [{ entityType: 'Person', foundCount: 5 }],
|
|
459
471
|
}}
|
|
460
472
|
/>
|
|
@@ -472,6 +484,9 @@ describe('ReferencesPanel Component', () => {
|
|
|
472
484
|
{...defaultProps}
|
|
473
485
|
isAssisting={false}
|
|
474
486
|
progress={{
|
|
487
|
+
stage: 'complete',
|
|
488
|
+
percentage: 100,
|
|
489
|
+
message: 'Annotation complete',
|
|
475
490
|
completedEntityTypes: [{ entityType: 'Person', foundCount: 5 }],
|
|
476
491
|
}}
|
|
477
492
|
/>
|
|
@@ -489,6 +504,9 @@ describe('ReferencesPanel Component', () => {
|
|
|
489
504
|
{...defaultProps}
|
|
490
505
|
isAssisting={false}
|
|
491
506
|
progress={{
|
|
507
|
+
stage: 'complete',
|
|
508
|
+
percentage: 100,
|
|
509
|
+
message: 'Annotation complete',
|
|
492
510
|
completedEntityTypes: [{ entityType: 'Person', foundCount: 5 }],
|
|
493
511
|
}}
|
|
494
512
|
/>
|
|
@@ -509,6 +527,9 @@ describe('ReferencesPanel Component', () => {
|
|
|
509
527
|
{...defaultProps}
|
|
510
528
|
isAssisting={false}
|
|
511
529
|
progress={{
|
|
530
|
+
stage: 'complete',
|
|
531
|
+
percentage: 100,
|
|
532
|
+
message: 'Annotation complete',
|
|
512
533
|
completedEntityTypes: [{ entityType: 'Person', foundCount: 5 }],
|
|
513
534
|
}}
|
|
514
535
|
/>
|
|
@@ -529,6 +550,9 @@ describe('ReferencesPanel Component', () => {
|
|
|
529
550
|
{...defaultProps}
|
|
530
551
|
isAssisting={false}
|
|
531
552
|
progress={{
|
|
553
|
+
stage: 'complete',
|
|
554
|
+
percentage: 100,
|
|
555
|
+
message: 'Annotation complete',
|
|
532
556
|
completedEntityTypes: [],
|
|
533
557
|
}}
|
|
534
558
|
/>
|
|
@@ -552,7 +576,7 @@ describe('ReferencesPanel Component', () => {
|
|
|
552
576
|
<ReferencesPanel
|
|
553
577
|
{...defaultProps}
|
|
554
578
|
isAssisting={true}
|
|
555
|
-
progress={{ completedEntityTypes: [] }}
|
|
579
|
+
progress={{ stage: 'analyzing', percentage: 0, message: 'Detecting references...', completedEntityTypes: [] }}
|
|
556
580
|
/>
|
|
557
581
|
);
|
|
558
582
|
|
|
@@ -566,7 +590,7 @@ describe('ReferencesPanel Component', () => {
|
|
|
566
590
|
<ReferencesPanel
|
|
567
591
|
{...defaultProps}
|
|
568
592
|
isAssisting={true}
|
|
569
|
-
progress={{ completedEntityTypes: [] }}
|
|
593
|
+
progress={{ stage: 'analyzing', percentage: 0, message: 'Detecting references...', completedEntityTypes: [] }}
|
|
570
594
|
/>
|
|
571
595
|
);
|
|
572
596
|
|
|
@@ -579,6 +603,9 @@ describe('ReferencesPanel Component', () => {
|
|
|
579
603
|
{...defaultProps}
|
|
580
604
|
isAssisting={false}
|
|
581
605
|
progress={{
|
|
606
|
+
stage: 'complete',
|
|
607
|
+
percentage: 100,
|
|
608
|
+
message: 'Annotation complete',
|
|
582
609
|
completedEntityTypes: [{ entityType: 'Person', foundCount: 5 }],
|
|
583
610
|
}}
|
|
584
611
|
/>
|
|
@@ -601,6 +628,9 @@ describe('ReferencesPanel Component', () => {
|
|
|
601
628
|
{...defaultProps}
|
|
602
629
|
isAssisting={false}
|
|
603
630
|
progress={{
|
|
631
|
+
stage: 'complete',
|
|
632
|
+
percentage: 100,
|
|
633
|
+
message: 'Annotation complete',
|
|
604
634
|
completedEntityTypes: [{ entityType: 'Person', foundCount: 5 }],
|
|
605
635
|
}}
|
|
606
636
|
/>
|
|
@@ -692,6 +722,9 @@ describe('ReferencesPanel Component', () => {
|
|
|
692
722
|
{...defaultProps}
|
|
693
723
|
isAssisting={false}
|
|
694
724
|
progress={{
|
|
725
|
+
stage: 'complete',
|
|
726
|
+
percentage: 100,
|
|
727
|
+
message: 'Annotation complete',
|
|
695
728
|
completedEntityTypes: [{ entityType: 'Person', foundCount: 0 }],
|
|
696
729
|
}}
|
|
697
730
|
/>
|
|
@@ -35,7 +35,7 @@ vi.mock('../../../../contexts/TranslationContext', () => ({
|
|
|
35
35
|
TranslationProvider: ({ children }: { children: React.ReactNode }) => children,
|
|
36
36
|
}));
|
|
37
37
|
|
|
38
|
-
// Mock @semiont/
|
|
38
|
+
// Mock @semiont/http-transport utilities
|
|
39
39
|
vi.mock('@semiont/core', async () => {
|
|
40
40
|
const actual = await vi.importActual('@semiont/core');
|
|
41
41
|
return {
|
|
@@ -295,7 +295,7 @@ describe('ResourceInfoPanel Component', () => {
|
|
|
295
295
|
renderWithEventBus(
|
|
296
296
|
<ResourceInfoPanel
|
|
297
297
|
{...defaultProps}
|
|
298
|
-
wasAttributedTo={{ name: 'Alice', '@id': 'https://example.org/alice' }}
|
|
298
|
+
wasAttributedTo={{ '@type': 'Person', name: 'Alice', '@id': 'https://example.org/alice' }}
|
|
299
299
|
/>
|
|
300
300
|
);
|
|
301
301
|
expect(screen.getByText('Attributed to')).toBeInTheDocument();
|
|
@@ -307,8 +307,8 @@ describe('ResourceInfoPanel Component', () => {
|
|
|
307
307
|
<ResourceInfoPanel
|
|
308
308
|
{...defaultProps}
|
|
309
309
|
wasAttributedTo={[
|
|
310
|
-
{ name: 'Alice' },
|
|
311
|
-
{ name: 'Bob' },
|
|
310
|
+
{ '@type': 'Person', name: 'Alice' },
|
|
311
|
+
{ '@type': 'Person', name: 'Bob' },
|
|
312
312
|
]}
|
|
313
313
|
/>
|
|
314
314
|
);
|
|
@@ -1,11 +1,9 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
2
|
-
import React from 'react';
|
|
3
2
|
import { screen } from '@testing-library/react';
|
|
4
3
|
import '@testing-library/jest-dom';
|
|
5
4
|
import { renderWithProviders } from '../../../../test-utils';
|
|
6
|
-
import type { components } from '@semiont/core';
|
|
7
5
|
|
|
8
|
-
import type { Annotation } from '@semiont/core';
|
|
6
|
+
import type { Annotation, AnnotationId } from '@semiont/core';
|
|
9
7
|
|
|
10
8
|
// Stable mock functions defined outside vi.mock to avoid re-render loops
|
|
11
9
|
const mockIsBodyResolved = vi.fn();
|
|
@@ -27,7 +25,7 @@ import { StatisticsPanel } from '../StatisticsPanel';
|
|
|
27
25
|
|
|
28
26
|
const createMockAnnotation = (overrides?: Partial<Annotation>): Annotation => ({
|
|
29
27
|
'@context': 'http://www.w3.org/ns/anno.jsonld',
|
|
30
|
-
id: 'http://example.com/annotations/1',
|
|
28
|
+
id: 'http://example.com/annotations/1' as AnnotationId,
|
|
31
29
|
type: 'Annotation',
|
|
32
30
|
motivation: 'linking',
|
|
33
31
|
created: '2024-06-15T12:00:00Z',
|
|
@@ -73,7 +71,7 @@ describe('StatisticsPanel', () => {
|
|
|
73
71
|
it('should render correct highlight count', () => {
|
|
74
72
|
const props = {
|
|
75
73
|
...emptyProps,
|
|
76
|
-
highlights: [createMockAnnotation({ id: 'h1' }), createMockAnnotation({ id: 'h2' }), createMockAnnotation({ id: 'h3' })],
|
|
74
|
+
highlights: [createMockAnnotation({ id: 'h1' as AnnotationId }), createMockAnnotation({ id: 'h2' as AnnotationId }), createMockAnnotation({ id: 'h3' as AnnotationId })],
|
|
77
75
|
};
|
|
78
76
|
|
|
79
77
|
renderWithProviders(<StatisticsPanel {...props} />);
|
|
@@ -85,7 +83,7 @@ describe('StatisticsPanel', () => {
|
|
|
85
83
|
it('should render correct comment count', () => {
|
|
86
84
|
const props = {
|
|
87
85
|
...emptyProps,
|
|
88
|
-
comments: [createMockAnnotation({ id: 'c1' }), createMockAnnotation({ id: 'c2' })],
|
|
86
|
+
comments: [createMockAnnotation({ id: 'c1' as AnnotationId }), createMockAnnotation({ id: 'c2' as AnnotationId })],
|
|
89
87
|
};
|
|
90
88
|
|
|
91
89
|
renderWithProviders(<StatisticsPanel {...props} />);
|
|
@@ -97,7 +95,7 @@ describe('StatisticsPanel', () => {
|
|
|
97
95
|
it('should render correct assessment count', () => {
|
|
98
96
|
const props = {
|
|
99
97
|
...emptyProps,
|
|
100
|
-
assessments: [createMockAnnotation({ id: 'a1' })],
|
|
98
|
+
assessments: [createMockAnnotation({ id: 'a1' as AnnotationId })],
|
|
101
99
|
};
|
|
102
100
|
|
|
103
101
|
renderWithProviders(<StatisticsPanel {...props} />);
|
|
@@ -110,10 +108,10 @@ describe('StatisticsPanel', () => {
|
|
|
110
108
|
const props = {
|
|
111
109
|
...emptyProps,
|
|
112
110
|
tags: [
|
|
113
|
-
createMockAnnotation({ id: 't1' }),
|
|
114
|
-
createMockAnnotation({ id: 't2' }),
|
|
115
|
-
createMockAnnotation({ id: 't3' }),
|
|
116
|
-
createMockAnnotation({ id: 't4' }),
|
|
111
|
+
createMockAnnotation({ id: 't1' as AnnotationId }),
|
|
112
|
+
createMockAnnotation({ id: 't2' as AnnotationId }),
|
|
113
|
+
createMockAnnotation({ id: 't3' as AnnotationId }),
|
|
114
|
+
createMockAnnotation({ id: 't4' as AnnotationId }),
|
|
117
115
|
],
|
|
118
116
|
};
|
|
119
117
|
|
|
@@ -124,9 +122,9 @@ describe('StatisticsPanel', () => {
|
|
|
124
122
|
});
|
|
125
123
|
|
|
126
124
|
it('should render correct total reference count', () => {
|
|
127
|
-
const refs = [createMockAnnotation({ id: 'r1' }), createMockAnnotation({ id: 'r2' })];
|
|
125
|
+
const refs = [createMockAnnotation({ id: 'r1' as AnnotationId }), createMockAnnotation({ id: 'r2' as AnnotationId })];
|
|
128
126
|
|
|
129
|
-
|
|
127
|
+
renderWithProviders(<StatisticsPanel {...emptyProps} references={refs} />);
|
|
130
128
|
|
|
131
129
|
expect(screen.getByText('StatisticsPanel.references')).toBeInTheDocument();
|
|
132
130
|
// The references item has the total count as its direct .semiont-statistics-panel__value child
|
|
@@ -139,13 +137,13 @@ describe('StatisticsPanel', () => {
|
|
|
139
137
|
describe('Reference sub-categories', () => {
|
|
140
138
|
it('should show stub and resolved counts', () => {
|
|
141
139
|
const refs = [
|
|
142
|
-
createMockAnnotation({ id: 'r1' }),
|
|
143
|
-
createMockAnnotation({ id: 'r2' }),
|
|
144
|
-
createMockAnnotation({ id: 'r3' }),
|
|
140
|
+
createMockAnnotation({ id: 'r1' as AnnotationId }),
|
|
141
|
+
createMockAnnotation({ id: 'r2' as AnnotationId }),
|
|
142
|
+
createMockAnnotation({ id: 'r3' as AnnotationId }),
|
|
145
143
|
];
|
|
146
144
|
|
|
147
145
|
// r1 resolved, r2 and r3 are stubs
|
|
148
|
-
mockIsBodyResolved.mockImplementation((
|
|
146
|
+
mockIsBodyResolved.mockImplementation(() => {
|
|
149
147
|
// We can distinguish by the call order
|
|
150
148
|
return false;
|
|
151
149
|
});
|
|
@@ -167,8 +165,8 @@ describe('StatisticsPanel', () => {
|
|
|
167
165
|
|
|
168
166
|
it('should count all as resolved when isBodyResolved returns true', () => {
|
|
169
167
|
const refs = [
|
|
170
|
-
createMockAnnotation({ id: 'r1' }),
|
|
171
|
-
createMockAnnotation({ id: 'r2' }),
|
|
168
|
+
createMockAnnotation({ id: 'r1' as AnnotationId }),
|
|
169
|
+
createMockAnnotation({ id: 'r2' as AnnotationId }),
|
|
172
170
|
];
|
|
173
171
|
|
|
174
172
|
mockIsBodyResolved.mockReturnValue(true);
|
|
@@ -182,8 +180,8 @@ describe('StatisticsPanel', () => {
|
|
|
182
180
|
|
|
183
181
|
it('should count all as stubs when isBodyResolved returns false', () => {
|
|
184
182
|
const refs = [
|
|
185
|
-
createMockAnnotation({ id: 'r1' }),
|
|
186
|
-
createMockAnnotation({ id: 'r2' }),
|
|
183
|
+
createMockAnnotation({ id: 'r1' as AnnotationId }),
|
|
184
|
+
createMockAnnotation({ id: 'r2' as AnnotationId }),
|
|
187
185
|
];
|
|
188
186
|
|
|
189
187
|
mockIsBodyResolved.mockReturnValue(false);
|
|
@@ -206,9 +204,9 @@ describe('StatisticsPanel', () => {
|
|
|
206
204
|
|
|
207
205
|
it('should render entity types with counts', () => {
|
|
208
206
|
const refs = [
|
|
209
|
-
createMockAnnotation({ id: 'r1' }),
|
|
210
|
-
createMockAnnotation({ id: 'r2' }),
|
|
211
|
-
createMockAnnotation({ id: 'r3' }),
|
|
207
|
+
createMockAnnotation({ id: 'r1' as AnnotationId }),
|
|
208
|
+
createMockAnnotation({ id: 'r2' as AnnotationId }),
|
|
209
|
+
createMockAnnotation({ id: 'r3' as AnnotationId }),
|
|
212
210
|
];
|
|
213
211
|
|
|
214
212
|
mockGetEntityTypes
|
|
@@ -226,9 +224,9 @@ describe('StatisticsPanel', () => {
|
|
|
226
224
|
|
|
227
225
|
it('should sort entity types by count descending', () => {
|
|
228
226
|
const refs = [
|
|
229
|
-
createMockAnnotation({ id: 'r1' }),
|
|
230
|
-
createMockAnnotation({ id: 'r2' }),
|
|
231
|
-
createMockAnnotation({ id: 'r3' }),
|
|
227
|
+
createMockAnnotation({ id: 'r1' as AnnotationId }),
|
|
228
|
+
createMockAnnotation({ id: 'r2' as AnnotationId }),
|
|
229
|
+
createMockAnnotation({ id: 'r3' as AnnotationId }),
|
|
232
230
|
];
|
|
233
231
|
|
|
234
232
|
// Person appears 3 times, Location 1 time
|
|
@@ -251,11 +249,11 @@ describe('StatisticsPanel', () => {
|
|
|
251
249
|
describe('Mixed annotation counts', () => {
|
|
252
250
|
it('should render all categories with their respective counts simultaneously', () => {
|
|
253
251
|
const props = {
|
|
254
|
-
highlights: [createMockAnnotation({ id: 'h1' })],
|
|
255
|
-
comments: [createMockAnnotation({ id: 'c1' }), createMockAnnotation({ id: 'c2' })],
|
|
256
|
-
assessments: [createMockAnnotation({ id: 'a1' }), createMockAnnotation({ id: 'a2' }), createMockAnnotation({ id: 'a3' })],
|
|
257
|
-
references: [createMockAnnotation({ id: 'r1' })],
|
|
258
|
-
tags: [createMockAnnotation({ id: 't1' }), createMockAnnotation({ id: 't2' })],
|
|
252
|
+
highlights: [createMockAnnotation({ id: 'h1' as AnnotationId })],
|
|
253
|
+
comments: [createMockAnnotation({ id: 'c1' as AnnotationId }), createMockAnnotation({ id: 'c2' as AnnotationId })],
|
|
254
|
+
assessments: [createMockAnnotation({ id: 'a1' as AnnotationId }), createMockAnnotation({ id: 'a2' as AnnotationId }), createMockAnnotation({ id: 'a3' as AnnotationId })],
|
|
255
|
+
references: [createMockAnnotation({ id: 'r1' as AnnotationId })],
|
|
256
|
+
tags: [createMockAnnotation({ id: 't1' as AnnotationId }), createMockAnnotation({ id: 't2' as AnnotationId })],
|
|
259
257
|
};
|
|
260
258
|
|
|
261
259
|
renderWithProviders(<StatisticsPanel {...props} />);
|
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, vi } from 'vitest';
|
|
2
|
-
import React from 'react';
|
|
3
2
|
import { render, screen } from '@testing-library/react';
|
|
4
3
|
import '@testing-library/jest-dom';
|
|
5
4
|
import { of } from 'rxjs';
|
|
6
5
|
import { CacheObservable } from '@semiont/sdk';
|
|
7
6
|
import { renderWithProviders, createTestSemiontWrapper } from '../../../../test-utils';
|
|
8
7
|
import userEvent from '@testing-library/user-event';
|
|
9
|
-
import type {
|
|
8
|
+
import type { TagSchema } from '@semiont/core';
|
|
10
9
|
|
|
11
|
-
import type { Annotation } from '@semiont/core';
|
|
10
|
+
import type { Annotation, AnnotationId } from '@semiont/core';
|
|
12
11
|
|
|
13
|
-
// Mock @semiont/
|
|
12
|
+
// Mock @semiont/http-transport
|
|
14
13
|
vi.mock('@semiont/core', async () => {
|
|
15
14
|
const actual = await vi.importActual('@semiont/core');
|
|
16
15
|
return {
|
|
@@ -37,10 +36,11 @@ const mockGetTagSchemaId = getTagSchemaId as MockedFunction<typeof getTagSchemaI
|
|
|
37
36
|
|
|
38
37
|
const createMockTag = (overrides?: Partial<Annotation>): Annotation => ({
|
|
39
38
|
'@context': 'http://www.w3.org/ns/anno.jsonld',
|
|
40
|
-
id: 'tag-1',
|
|
39
|
+
id: 'tag-1' as AnnotationId,
|
|
41
40
|
type: 'Annotation',
|
|
42
41
|
motivation: 'tagging',
|
|
43
42
|
creator: {
|
|
43
|
+
'@type': 'Person',
|
|
44
44
|
name: 'tagger@example.com',
|
|
45
45
|
},
|
|
46
46
|
created: '2024-06-15T12:00:00Z',
|
|
@@ -71,7 +71,7 @@ describe('TagEntry', () => {
|
|
|
71
71
|
vi.clearAllMocks();
|
|
72
72
|
mockGetAnnotationExactText.mockReturnValue('Tagged text content');
|
|
73
73
|
mockGetTagCategory.mockReturnValue('Entity');
|
|
74
|
-
mockGetTagSchemaId.mockReturnValue(
|
|
74
|
+
mockGetTagSchemaId.mockReturnValue(undefined);
|
|
75
75
|
});
|
|
76
76
|
|
|
77
77
|
describe('Rendering', () => {
|
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { describe, it, expect, beforeEach, afterEach, vi } from 'vitest';
|
|
2
2
|
import type { MockedFunction } from 'vitest';
|
|
3
3
|
import React from 'react';
|
|
4
|
-
import { render, screen,
|
|
4
|
+
import { render, screen, waitFor } from '@testing-library/react';
|
|
5
5
|
import userEvent from '@testing-library/user-event';
|
|
6
6
|
import '@testing-library/jest-dom';
|
|
7
7
|
import { of } from 'rxjs';
|
|
8
8
|
import { CacheObservable } from '@semiont/sdk';
|
|
9
9
|
import { TaggingPanel } from '../TaggingPanel';
|
|
10
|
-
import type {
|
|
10
|
+
import type { EventBus, TagSchema } from '@semiont/core';
|
|
11
11
|
import { createTestSemiontWrapper } from '../../../../test-utils';
|
|
12
12
|
|
|
13
|
-
import type { Annotation } from '@semiont/core';
|
|
13
|
+
import type { Annotation, AnnotationId } from '@semiont/core';
|
|
14
14
|
|
|
15
15
|
// Composition-based event tracker
|
|
16
16
|
interface TrackedEvent {
|
|
@@ -112,7 +112,7 @@ vi.mock('../../../../contexts/TranslationContext', () => ({
|
|
|
112
112
|
TranslationProvider: ({ children }: { children: React.ReactNode }) => children,
|
|
113
113
|
}));
|
|
114
114
|
|
|
115
|
-
// Mock @semiont/
|
|
115
|
+
// Mock @semiont/http-transport utilities
|
|
116
116
|
vi.mock('@semiont/core', async () => {
|
|
117
117
|
const actual = await vi.importActual('@semiont/core');
|
|
118
118
|
return {
|
|
@@ -124,7 +124,7 @@ vi.mock('@semiont/core', async () => {
|
|
|
124
124
|
|
|
125
125
|
// Mock TagEntry component to simplify testing
|
|
126
126
|
vi.mock('../TagEntry', () => ({
|
|
127
|
-
TagEntry: ({ tag
|
|
127
|
+
TagEntry: ({ tag }: any) => (
|
|
128
128
|
<div data-testid={`tag-${tag.id}`}>
|
|
129
129
|
<div>{tag.id}</div>
|
|
130
130
|
</div>
|
|
@@ -138,10 +138,11 @@ const mockGetTargetSelector = getTargetSelector as MockedFunction<typeof getTarg
|
|
|
138
138
|
// Test data fixtures
|
|
139
139
|
const createMockTag = (id: string, start: number, end: number, tagName: string = 'Issue'): Annotation => ({
|
|
140
140
|
'@context': 'http://www.w3.org/ns/anno.jsonld',
|
|
141
|
-
id,
|
|
141
|
+
id: id as AnnotationId,
|
|
142
142
|
type: 'Annotation',
|
|
143
143
|
motivation: 'tagging',
|
|
144
144
|
creator: {
|
|
145
|
+
'@type': 'Person',
|
|
145
146
|
name: `user${id}@example.com`,
|
|
146
147
|
},
|
|
147
148
|
created: `2024-01-0${id.slice(-1)}T10:00:00Z`,
|
|
@@ -45,16 +45,12 @@ const createProps = (overrides?: Partial<AdminExchangePageProps>): AdminExchange
|
|
|
45
45
|
},
|
|
46
46
|
progress: {
|
|
47
47
|
phaseStarted: 'Starting…',
|
|
48
|
-
phaseEntityTypes: 'Entity types…',
|
|
49
|
-
phaseResources: 'Resources…',
|
|
50
|
-
phaseAnnotations: 'Annotations…',
|
|
51
48
|
phaseComplete: 'Complete',
|
|
52
49
|
phaseError: 'Failed',
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
blobs: 'Blobs',
|
|
50
|
+
statsEventsReplayed: 'Events replayed',
|
|
51
|
+
statsResourcesCreated: 'Resources created',
|
|
52
|
+
statsAnnotationsCreated: 'Annotations created',
|
|
53
|
+
statsEntityTypesAdded: 'Entity types added',
|
|
58
54
|
},
|
|
59
55
|
},
|
|
60
56
|
ToolbarPanels: () => <div data-testid="toolbar-panels" />,
|
|
@@ -100,10 +96,11 @@ describe('AdminExchangePage', () => {
|
|
|
100
96
|
it('renders ImportProgress with backup result on completion', () => {
|
|
101
97
|
render(<AdminExchangePage {...createProps({
|
|
102
98
|
importPhase: 'complete',
|
|
103
|
-
importResult: { stats: {
|
|
99
|
+
importResult: { stats: { eventsReplayed: 42, resourcesCreated: 5, annotationsCreated: 12, entityTypesAdded: 3 } },
|
|
104
100
|
})} />);
|
|
105
101
|
expect(screen.getByText('Complete')).toBeInTheDocument();
|
|
106
|
-
expect(screen.getByText('
|
|
102
|
+
expect(screen.getByText('42')).toBeInTheDocument();
|
|
103
|
+
expect(screen.getByText('Events replayed')).toBeInTheDocument();
|
|
107
104
|
});
|
|
108
105
|
|
|
109
106
|
it('applies panel-open class when common panel is active', () => {
|
|
@@ -9,16 +9,12 @@ import type { ImportProgressProps } from '../components/ImportProgress';
|
|
|
9
9
|
|
|
10
10
|
const translations: ImportProgressProps['translations'] = {
|
|
11
11
|
phaseStarted: 'Starting restore…',
|
|
12
|
-
phaseEntityTypes: 'Adding entity types…',
|
|
13
|
-
phaseResources: 'Creating resources…',
|
|
14
|
-
phaseAnnotations: 'Creating annotations…',
|
|
15
12
|
phaseComplete: 'Restore complete',
|
|
16
13
|
phaseError: 'Restore failed',
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
blobs: 'Content blobs',
|
|
14
|
+
statsEventsReplayed: 'Events replayed',
|
|
15
|
+
statsResourcesCreated: 'Resources created',
|
|
16
|
+
statsAnnotationsCreated: 'Annotations created',
|
|
17
|
+
statsEntityTypesAdded: 'Entity types added',
|
|
22
18
|
};
|
|
23
19
|
|
|
24
20
|
describe('ImportProgress', () => {
|
|
@@ -33,8 +29,8 @@ describe('ImportProgress', () => {
|
|
|
33
29
|
});
|
|
34
30
|
|
|
35
31
|
it('renders message during active phases', () => {
|
|
36
|
-
render(<ImportProgress phase="
|
|
37
|
-
expect(screen.getByText('
|
|
32
|
+
render(<ImportProgress phase="started" message="Restoring backup..." translations={translations} />);
|
|
33
|
+
expect(screen.getByText('Restoring backup...')).toBeInTheDocument();
|
|
38
34
|
});
|
|
39
35
|
|
|
40
36
|
it('does not render message during complete phase', () => {
|
|
@@ -61,44 +57,59 @@ describe('ImportProgress', () => {
|
|
|
61
57
|
expect(screen.getByText('Connection failed')).toBeInTheDocument();
|
|
62
58
|
});
|
|
63
59
|
|
|
64
|
-
it('renders backup
|
|
60
|
+
it('renders backup restore stats nested under result.stats', () => {
|
|
65
61
|
render(<ImportProgress
|
|
66
62
|
phase="complete"
|
|
67
|
-
result={{ stats: {
|
|
63
|
+
result={{ stats: { eventsReplayed: 42, resourcesCreated: 5, annotationsCreated: 12, entityTypesAdded: 3 } }}
|
|
68
64
|
translations={translations}
|
|
69
65
|
/>);
|
|
70
|
-
expect(screen.getByText('5')).toBeInTheDocument();
|
|
71
|
-
expect(screen.getByText('Event streams')).toBeInTheDocument();
|
|
72
66
|
expect(screen.getByText('42')).toBeInTheDocument();
|
|
73
|
-
expect(screen.getByText('Events')).toBeInTheDocument();
|
|
67
|
+
expect(screen.getByText('Events replayed')).toBeInTheDocument();
|
|
68
|
+
expect(screen.getByText('5')).toBeInTheDocument();
|
|
69
|
+
expect(screen.getByText('Resources created')).toBeInTheDocument();
|
|
70
|
+
expect(screen.getByText('12')).toBeInTheDocument();
|
|
71
|
+
expect(screen.getByText('Annotations created')).toBeInTheDocument();
|
|
74
72
|
expect(screen.getByText('3')).toBeInTheDocument();
|
|
75
|
-
expect(screen.getByText('
|
|
73
|
+
expect(screen.getByText('Entity types added')).toBeInTheDocument();
|
|
76
74
|
});
|
|
77
75
|
|
|
78
|
-
it('renders
|
|
79
|
-
|
|
76
|
+
it('renders linked-data import stats nested under result.stats', () => {
|
|
77
|
+
render(<ImportProgress
|
|
80
78
|
phase="complete"
|
|
81
|
-
result={{
|
|
79
|
+
result={{ stats: { resourcesCreated: 5, annotationsCreated: 12, entityTypesAdded: 3 } }}
|
|
82
80
|
translations={translations}
|
|
83
81
|
/>);
|
|
84
|
-
expect(screen.getByText('
|
|
85
|
-
expect(
|
|
82
|
+
expect(screen.getByText('5')).toBeInTheDocument();
|
|
83
|
+
expect(screen.getByText('Resources created')).toBeInTheDocument();
|
|
84
|
+
expect(screen.getByText('12')).toBeInTheDocument();
|
|
85
|
+
expect(screen.getByText('Annotations created')).toBeInTheDocument();
|
|
86
|
+
expect(screen.getByText('3')).toBeInTheDocument();
|
|
87
|
+
expect(screen.getByText('Entity types added')).toBeInTheDocument();
|
|
86
88
|
});
|
|
87
89
|
|
|
88
|
-
it('
|
|
90
|
+
it('does not render result section when result lacks a stats object', () => {
|
|
89
91
|
const { container } = render(<ImportProgress
|
|
90
92
|
phase="complete"
|
|
91
|
-
result={{
|
|
93
|
+
result={{ resourcesCreated: 5 }}
|
|
94
|
+
translations={translations}
|
|
95
|
+
/>);
|
|
96
|
+
expect(container.querySelector('.semiont-exchange__result')).not.toBeInTheDocument();
|
|
97
|
+
});
|
|
98
|
+
|
|
99
|
+
it('renders raw key for unknown stats', () => {
|
|
100
|
+
render(<ImportProgress
|
|
101
|
+
phase="complete"
|
|
102
|
+
result={{ stats: { somethingNew: 7 } }}
|
|
92
103
|
translations={translations}
|
|
93
104
|
/>);
|
|
94
|
-
expect(screen.getByText('
|
|
95
|
-
expect(
|
|
105
|
+
expect(screen.getByText('7')).toBeInTheDocument();
|
|
106
|
+
expect(screen.getByText('somethingNew')).toBeInTheDocument();
|
|
96
107
|
});
|
|
97
108
|
|
|
98
109
|
it('does not render result section during non-complete phases', () => {
|
|
99
110
|
const { container } = render(<ImportProgress
|
|
100
|
-
phase="
|
|
101
|
-
result={{ stats: {
|
|
111
|
+
phase="started"
|
|
112
|
+
result={{ stats: { eventsReplayed: 42, resourcesCreated: 5, annotationsCreated: 12, entityTypesAdded: 3 } }}
|
|
102
113
|
translations={translations}
|
|
103
114
|
/>);
|
|
104
115
|
expect(container.querySelector('.semiont-exchange__result')).not.toBeInTheDocument();
|