@scality/data-browser-library 1.0.0-preview.8 → 1.0.1
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/components/DataBrowserUI.d.ts +12 -0
- package/dist/components/DataBrowserUI.js +99 -0
- package/dist/components/Editor.d.ts +1 -1
- package/dist/components/Editor.js +3 -3
- package/dist/components/__tests__/BucketAccessor.test.js +214 -0
- package/dist/components/__tests__/BucketCorsPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketCorsPage.test.js +263 -0
- package/dist/components/__tests__/BucketCreate.test.d.ts +1 -0
- package/dist/components/__tests__/BucketCreate.test.js +574 -0
- package/dist/components/__tests__/BucketDetails.test.d.ts +1 -0
- package/dist/components/__tests__/BucketDetails.test.js +421 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.d.ts +14 -0
- package/dist/components/__tests__/BucketLifecycleFormPage.test.js +618 -0
- package/dist/components/__tests__/BucketLifecycleList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketLifecycleList.test.js +325 -0
- package/dist/components/__tests__/BucketList.test.js +495 -81
- package/dist/components/__tests__/BucketNotificationFormPage.test.d.ts +1 -0
- package/dist/components/__tests__/BucketNotificationFormPage.test.js +348 -0
- package/dist/components/__tests__/BucketNotificationList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketNotificationList.test.js +379 -0
- package/dist/components/__tests__/BucketOverview.test.js +484 -179
- package/dist/components/__tests__/BucketPolicyPage.test.js +151 -99
- package/dist/components/__tests__/BucketReplicationFormPage.test.d.ts +16 -0
- package/dist/components/__tests__/BucketReplicationFormPage.test.js +1757 -0
- package/dist/components/__tests__/BucketReplicationList.test.d.ts +1 -0
- package/dist/components/__tests__/BucketReplicationList.test.js +344 -0
- package/dist/components/__tests__/CreateFolderButton.test.js +56 -56
- package/dist/components/__tests__/DeleteBucketButton.test.js +64 -64
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.d.ts +1 -0
- package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +196 -0
- package/dist/components/__tests__/DeleteObjectButton.test.js +64 -64
- package/dist/components/__tests__/EmptyBucketButton.test.d.ts +1 -0
- package/dist/components/__tests__/EmptyBucketButton.test.js +302 -0
- package/dist/components/__tests__/MetadataSearch.test.js +65 -65
- package/dist/components/__tests__/ObjectList.test.js +741 -240
- package/dist/components/__tests__/UploadButton.test.js +45 -45
- package/dist/components/breadcrumb/Breadcrumb.d.ts +6 -0
- package/dist/components/breadcrumb/Breadcrumb.js +37 -0
- package/dist/components/breadcrumb/DataBrowserBreadcrumb.d.ts +1 -0
- package/dist/components/breadcrumb/DataBrowserBreadcrumb.js +10 -0
- package/dist/components/breadcrumb/__tests__/Breadcrumb.test.d.ts +1 -0
- package/dist/components/breadcrumb/__tests__/Breadcrumb.test.js +196 -0
- package/dist/components/breadcrumb/__tests__/DataBrowserBreadcrumb.test.d.ts +1 -0
- package/dist/components/breadcrumb/__tests__/DataBrowserBreadcrumb.test.js +153 -0
- package/dist/components/breadcrumb/__tests__/useBreadcrumbPaths.test.d.ts +1 -0
- package/dist/components/breadcrumb/__tests__/useBreadcrumbPaths.test.js +134 -0
- package/dist/components/breadcrumb/index.d.ts +8 -0
- package/dist/components/breadcrumb/index.js +4 -0
- package/dist/components/breadcrumb/useBreadcrumbPaths.d.ts +2 -0
- package/dist/components/breadcrumb/useBreadcrumbPaths.js +82 -0
- package/dist/components/buckets/BucketAccessor.d.ts +2 -0
- package/dist/components/buckets/BucketAccessor.js +125 -0
- package/dist/components/buckets/BucketConfigEditButton.d.ts +8 -0
- package/dist/components/buckets/{BucketPolicyButton.js → BucketConfigEditButton.js} +9 -5
- package/dist/components/buckets/BucketCorsPage.d.ts +1 -0
- package/dist/components/buckets/BucketCorsPage.js +234 -0
- package/dist/components/buckets/BucketCreate.d.ts +50 -0
- package/dist/components/buckets/BucketCreate.js +279 -0
- package/dist/components/buckets/BucketDetails.d.ts +42 -0
- package/dist/components/buckets/BucketDetails.js +256 -40
- package/dist/components/buckets/BucketLifecycleFormPage.d.ts +15 -0
- package/dist/components/buckets/BucketLifecycleFormPage.js +1086 -0
- package/dist/components/buckets/BucketLifecycleList.d.ts +10 -0
- package/dist/components/buckets/BucketLifecycleList.js +270 -0
- package/dist/components/buckets/BucketList.d.ts +6 -4
- package/dist/components/buckets/BucketList.js +161 -94
- package/dist/components/buckets/BucketLocation.js +4 -4
- package/dist/components/buckets/BucketOverview.d.ts +86 -5
- package/dist/components/buckets/BucketOverview.js +481 -192
- package/dist/components/buckets/BucketPage.js +44 -22
- package/dist/components/buckets/BucketPolicyPage.js +155 -127
- package/dist/components/buckets/BucketReplicationFormPage.d.ts +1 -0
- package/dist/components/buckets/BucketReplicationFormPage.js +835 -0
- package/dist/components/buckets/BucketReplicationList.d.ts +11 -0
- package/dist/components/buckets/BucketReplicationList.js +189 -0
- package/dist/components/buckets/BucketVersioning.d.ts +4 -0
- package/dist/components/buckets/BucketVersioning.js +76 -0
- package/dist/components/buckets/DeleteBucketButton.js +8 -8
- package/dist/components/buckets/DeleteBucketConfigRuleButton.d.ts +18 -0
- package/dist/components/buckets/DeleteBucketConfigRuleButton.js +53 -0
- package/dist/components/buckets/EmptyBucketButton.d.ts +5 -0
- package/dist/components/buckets/EmptyBucketButton.js +232 -0
- package/dist/components/buckets/EmptyBucketSummary.d.ts +9 -0
- package/dist/components/buckets/EmptyBucketSummary.js +60 -0
- package/dist/components/buckets/EmptyBucketSummaryList.d.ts +13 -0
- package/dist/components/buckets/EmptyBucketSummaryList.js +140 -0
- package/dist/components/buckets/__tests__/BucketVersioning.test.d.ts +1 -0
- package/dist/components/buckets/__tests__/BucketVersioning.test.js +163 -0
- package/dist/components/buckets/notifications/BucketNotificationFormPage.d.ts +1 -0
- package/dist/components/buckets/notifications/BucketNotificationFormPage.js +316 -0
- package/dist/components/buckets/notifications/BucketNotificationList.d.ts +10 -0
- package/dist/components/buckets/notifications/BucketNotificationList.js +267 -0
- package/dist/components/buckets/notifications/EventsSection.js +145 -29
- package/dist/components/buckets/notifications/__tests__/events.test.d.ts +1 -0
- package/dist/components/buckets/notifications/__tests__/events.test.js +56 -0
- package/dist/components/buckets/notifications/events.d.ts +71 -7
- package/dist/components/buckets/notifications/events.js +98 -16
- package/dist/components/index.d.ts +27 -13
- package/dist/components/index.js +20 -6
- package/dist/components/layouts/ArrowNavigation.d.ts +3 -0
- package/dist/components/layouts/ArrowNavigation.js +28 -0
- package/dist/components/layouts/BrowserPageLayout.d.ts +5 -1
- package/dist/components/layouts/BrowserPageLayout.js +10 -5
- package/dist/components/objects/CreateFolderButton.d.ts +2 -2
- package/dist/components/objects/CreateFolderButton.js +12 -12
- package/dist/components/objects/DeleteObjectButton.d.ts +1 -1
- package/dist/components/objects/DeleteObjectButton.js +19 -21
- package/dist/components/objects/GetPresignedUrlButton.d.ts +7 -0
- package/dist/components/objects/GetPresignedUrlButton.js +255 -0
- package/dist/components/objects/ObjectDetails/ObjectMetadata.d.ts +2 -2
- package/dist/components/objects/ObjectDetails/ObjectMetadata.js +263 -230
- package/dist/components/objects/ObjectDetails/ObjectSummary.d.ts +2 -2
- package/dist/components/objects/ObjectDetails/ObjectSummary.js +540 -138
- package/dist/components/objects/ObjectDetails/ObjectTags.d.ts +2 -2
- package/dist/components/objects/ObjectDetails/ObjectTags.js +95 -123
- package/dist/components/objects/ObjectDetails/__tests__/ObjectDetails.test.d.ts +1 -0
- package/dist/components/objects/ObjectDetails/__tests__/ObjectDetails.test.js +516 -0
- package/dist/components/objects/ObjectDetails/__tests__/ObjectSummary.test.d.ts +1 -0
- package/dist/components/objects/ObjectDetails/__tests__/ObjectSummary.test.js +1064 -0
- package/dist/components/objects/ObjectDetails/index.d.ts +18 -2
- package/dist/components/objects/ObjectDetails/index.js +152 -40
- package/dist/components/objects/ObjectList.d.ts +12 -10
- package/dist/components/objects/ObjectList.js +590 -263
- package/dist/components/objects/ObjectLock/EditRetentionButton.d.ts +4 -0
- package/dist/components/objects/ObjectLock/EditRetentionButton.js +32 -0
- package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.d.ts +3 -0
- package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.js +211 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettings.d.ts +9 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettings.js +159 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.d.ts +8 -0
- package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.js +39 -0
- package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.d.ts +1 -0
- package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.js +204 -0
- package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.d.ts +1 -0
- package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.js +374 -0
- package/dist/components/objects/ObjectPage.js +12 -8
- package/dist/components/objects/UploadButton.d.ts +3 -3
- package/dist/components/objects/UploadButton.js +10 -10
- package/dist/components/objects/__tests__/GetPresignedUrlButton.test.d.ts +1 -0
- package/dist/components/objects/__tests__/GetPresignedUrlButton.test.js +531 -0
- package/dist/components/providers/DataBrowserProvider.d.ts +23 -12
- package/dist/components/providers/DataBrowserProvider.js +60 -38
- package/dist/components/providers/QueryProvider.d.ts +9 -0
- package/dist/components/providers/QueryProvider.js +21 -0
- package/dist/components/search/MetadataSearch.js +29 -28
- package/dist/components/search/SearchHints.js +1 -1
- package/dist/components/ui/ArrayFieldActions.d.ts +36 -0
- package/dist/components/ui/ArrayFieldActions.js +43 -0
- package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +16 -0
- package/dist/components/ui/ConfirmDeleteRuleModal.js +48 -0
- package/dist/components/ui/DeleteObjectModalContent.d.ts +1 -1
- package/dist/components/ui/DeleteObjectModalContent.js +12 -12
- package/dist/components/ui/FilterFormSection.d.ts +44 -0
- package/dist/components/ui/FilterFormSection.js +159 -0
- package/dist/components/ui/Search.elements.d.ts +2 -2
- package/dist/components/ui/Search.elements.js +7 -7
- package/dist/components/ui/Table.elements.d.ts +2 -1
- package/dist/components/ui/Table.elements.js +18 -12
- package/dist/config/__tests__/factory.test.d.ts +1 -0
- package/dist/config/__tests__/factory.test.js +311 -0
- package/dist/config/factory.d.ts +14 -49
- package/dist/config/factory.js +23 -68
- package/dist/config/types.d.ts +212 -34
- package/dist/contexts/DataBrowserUICustomizationContext.d.ts +27 -0
- package/dist/contexts/DataBrowserUICustomizationContext.js +13 -0
- package/dist/hooks/__tests__/useAccessibleBuckets.test.d.ts +1 -0
- package/dist/hooks/__tests__/useAccessibleBuckets.test.js +145 -0
- package/dist/hooks/__tests__/useISVBucketDetection.test.d.ts +1 -0
- package/dist/hooks/__tests__/useISVBucketDetection.test.js +188 -0
- package/dist/hooks/__tests__/useIsBucketEmpty.test.js +27 -27
- package/dist/hooks/__tests__/useLoginMutation.test.d.ts +1 -0
- package/dist/hooks/__tests__/useLoginMutation.test.js +194 -0
- package/dist/hooks/bucketConfiguration.d.ts +8 -1
- package/dist/hooks/bucketConfiguration.js +52 -51
- package/dist/hooks/bucketOperations.d.ts +10 -1
- package/dist/hooks/bucketOperations.js +10 -9
- package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.js +80 -80
- package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.js +80 -80
- package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.js +44 -44
- package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.js +63 -63
- package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +95 -52
- package/dist/hooks/factories/index.d.ts +4 -4
- package/dist/hooks/factories/index.js +2 -2
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3InfiniteQueryHook.js +16 -13
- package/dist/hooks/factories/useCreateS3LoginHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3LoginHook.js +1 -1
- package/dist/hooks/factories/useCreateS3MutationHook.d.ts +3 -3
- package/dist/hooks/factories/useCreateS3MutationHook.js +7 -2
- package/dist/hooks/factories/useCreateS3QueryHook.d.ts +2 -2
- package/dist/hooks/factories/useCreateS3QueryHook.js +29 -3
- package/dist/hooks/index.d.ts +19 -8
- package/dist/hooks/index.js +16 -5
- package/dist/hooks/loginOperations.d.ts +1 -1
- package/dist/hooks/loginOperations.js +1 -1
- package/dist/hooks/objectOperations.d.ts +2 -2
- package/dist/hooks/objectOperations.js +50 -49
- package/dist/hooks/presignedOperations.d.ts +4 -4
- package/dist/hooks/presignedOperations.js +5 -5
- package/dist/hooks/useAccessibleBuckets.d.ts +11 -0
- package/dist/hooks/useAccessibleBuckets.js +115 -0
- package/dist/hooks/useBatchObjectLegalHold.d.ts +11 -0
- package/dist/hooks/useBatchObjectLegalHold.js +48 -0
- package/dist/hooks/useBucketConfigEditor.d.ts +31 -0
- package/dist/hooks/useBucketConfigEditor.js +82 -0
- package/dist/hooks/useDataBrowserNavigate.d.ts +28 -0
- package/dist/hooks/useDataBrowserNavigate.js +24 -0
- package/dist/hooks/useDeleteBucketConfigRule.d.ts +26 -0
- package/dist/hooks/useDeleteBucketConfigRule.js +46 -0
- package/dist/hooks/useEmptyBucket.d.ts +27 -0
- package/dist/hooks/useEmptyBucket.js +116 -0
- package/dist/hooks/useFeatures.d.ts +7 -0
- package/dist/hooks/useFeatures.js +8 -0
- package/dist/hooks/useISVBucketDetection.d.ts +15 -0
- package/dist/hooks/useISVBucketDetection.js +27 -0
- package/dist/hooks/useIsBucketEmpty.js +4 -4
- package/dist/hooks/useLimitedAccessFlow.d.ts +48 -0
- package/dist/hooks/useLimitedAccessFlow.js +23 -0
- package/dist/hooks/useS3Client.d.ts +6 -0
- package/dist/hooks/useS3Client.js +3 -2
- package/dist/hooks/useS3ConfigSwitch.d.ts +11 -0
- package/dist/hooks/useS3ConfigSwitch.js +37 -0
- package/dist/hooks/useSupportedNotificationEvents.d.ts +6 -0
- package/dist/hooks/useSupportedNotificationEvents.js +8 -0
- package/dist/hooks/useTableRowSelection.d.ts +9 -0
- package/dist/hooks/useTableRowSelection.js +45 -0
- package/dist/index.d.ts +6 -6
- package/dist/index.js +2 -2
- package/dist/schemas/bucketPolicySchema.json +3 -13
- package/dist/test/msw/handlers/deleteBucket.d.ts +1 -1
- package/dist/test/msw/handlers/deleteBucket.js +20 -10
- package/dist/test/msw/handlers/getBucketAcl.d.ts +1 -1
- package/dist/test/msw/handlers/getBucketAcl.js +29 -17
- package/dist/test/msw/handlers/getBucketLocation.d.ts +1 -1
- package/dist/test/msw/handlers/getBucketLocation.js +29 -15
- package/dist/test/msw/handlers/getBucketPolicy.d.ts +1 -1
- package/dist/test/msw/handlers/getBucketPolicy.js +52 -32
- package/dist/test/msw/handlers/headObject.d.ts +1 -1
- package/dist/test/msw/handlers/headObject.js +31 -13
- package/dist/test/msw/handlers/listBuckets.d.ts +1 -1
- package/dist/test/msw/handlers/listBuckets.js +5 -3
- package/dist/test/msw/handlers/listObjectVersions.d.ts +1 -1
- package/dist/test/msw/handlers/listObjectVersions.js +38 -26
- package/dist/test/msw/handlers/listObjects.d.ts +1 -1
- package/dist/test/msw/handlers/listObjects.js +35 -23
- package/dist/test/msw/handlers/objectLegalHold.d.ts +1 -1
- package/dist/test/msw/handlers/objectLegalHold.js +32 -17
- package/dist/test/msw/handlers/objectRetention.d.ts +1 -1
- package/dist/test/msw/handlers/objectRetention.js +31 -17
- package/dist/test/msw/handlers/putBucketAcl.d.ts +1 -1
- package/dist/test/msw/handlers/putBucketAcl.js +29 -14
- package/dist/test/msw/handlers/putObject.d.ts +1 -1
- package/dist/test/msw/handlers/putObject.js +27 -12
- package/dist/test/msw/handlers.d.ts +3 -3
- package/dist/test/msw/handlers.js +77 -54
- package/dist/test/msw/index.d.ts +2 -2
- package/dist/test/msw/index.js +1 -1
- package/dist/test/msw/server.d.ts +1 -1
- package/dist/test/msw/server.js +1 -1
- package/dist/test/msw/utils.js +2 -2
- package/dist/test/setup.d.ts +1 -1
- package/dist/test/setup.js +13 -30
- package/dist/test/testUtils.d.ts +170 -36
- package/dist/test/testUtils.js +229 -116
- package/dist/test/utils/errorHandling.test.js +146 -108
- package/dist/types/index.d.ts +49 -36
- package/dist/types/monaco.d.ts +13 -0
- package/dist/types/monaco.js +0 -0
- package/dist/utils/__tests__/proxyMiddleware.test.d.ts +1 -0
- package/dist/utils/__tests__/proxyMiddleware.test.js +579 -0
- package/dist/utils/__tests__/s3Client.test.d.ts +1 -0
- package/dist/utils/__tests__/s3Client.test.js +340 -0
- package/dist/utils/__tests__/s3ConfigIdentifier.test.d.ts +1 -0
- package/dist/utils/__tests__/s3ConfigIdentifier.test.js +437 -0
- package/dist/utils/constants.d.ts +22 -0
- package/dist/utils/constants.js +19 -0
- package/dist/utils/deletion/index.d.ts +2 -2
- package/dist/utils/deletion/index.js +1 -1
- package/dist/utils/deletion/messages.d.ts +1 -1
- package/dist/utils/deletion/messages.js +4 -4
- package/dist/utils/errorHandling.d.ts +12 -3
- package/dist/utils/errorHandling.js +12 -7
- package/dist/utils/hooks.js +8 -8
- package/dist/utils/index.d.ts +5 -2
- package/dist/utils/index.js +5 -1
- package/dist/utils/proxyMiddleware.d.ts +32 -13
- package/dist/utils/proxyMiddleware.js +90 -36
- package/dist/utils/s3Client.d.ts +14 -4
- package/dist/utils/s3Client.js +5 -26
- package/dist/utils/s3ConfigIdentifier.d.ts +79 -0
- package/dist/utils/s3ConfigIdentifier.js +57 -0
- package/dist/utils/s3RuleUtils.d.ts +53 -0
- package/dist/utils/s3RuleUtils.js +101 -0
- package/package.json +10 -8
- package/dist/components/__tests__/BucketNotificationCreatePage.test.js +0 -316
- package/dist/components/buckets/BucketPolicyButton.d.ts +0 -7
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.d.ts +0 -1
- package/dist/components/buckets/notifications/BucketNotificationCreatePage.js +0 -234
- package/dist/hooks/useLoginMutation.d.ts +0 -21
- package/dist/hooks/useLoginMutation.js +0 -9
- package/dist/utils/useFeatures.d.ts +0 -1
- package/dist/utils/useFeatures.js +0 -7
- /package/dist/components/__tests__/{BucketNotificationCreatePage.test.d.ts → BucketAccessor.test.d.ts} +0 -0
|
@@ -0,0 +1,421 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { render, screen, waitFor } from "@testing-library/react";
|
|
3
|
+
import { MemoryRouter } from "react-router";
|
|
4
|
+
import { useGetBucketAcl, useGetBucketCors, useGetBucketLifecycle, useGetBucketLocation, useGetBucketObjectLockConfiguration, useGetBucketPolicy, useGetBucketReplication, useGetBucketTagging, useGetBucketVersioning } from "../../hooks/index.js";
|
|
5
|
+
import { useFeatures } from "../../hooks/useFeatures.js";
|
|
6
|
+
import { useISVBucketStatus } from "../../hooks/useISVBucketDetection.js";
|
|
7
|
+
import { applyBucketMocks, createTestWrapper } from "../../test/testUtils.js";
|
|
8
|
+
import { BucketDetails } from "../buckets/BucketDetails.js";
|
|
9
|
+
import * as __rspack_external__contexts_DataBrowserUICustomizationContext_js_f267b01c from "../../contexts/DataBrowserUICustomizationContext.js";
|
|
10
|
+
jest.mock('../../hooks');
|
|
11
|
+
jest.mock('../../hooks/useISVBucketDetection');
|
|
12
|
+
jest.mock('../../hooks/useFeatures');
|
|
13
|
+
const mockUseParams = jest.fn();
|
|
14
|
+
const mockUseNavigate = jest.fn();
|
|
15
|
+
jest.mock('react-router', ()=>({
|
|
16
|
+
...jest.requireActual('react-router'),
|
|
17
|
+
useParams: ()=>mockUseParams(),
|
|
18
|
+
useNavigate: ()=>mockUseNavigate()
|
|
19
|
+
}));
|
|
20
|
+
const mockUseGetBucketLifecycle = jest.mocked(useGetBucketLifecycle);
|
|
21
|
+
const mockUseGetBucketReplication = jest.mocked(useGetBucketReplication);
|
|
22
|
+
const mockUseGetBucketVersioning = jest.mocked(useGetBucketVersioning);
|
|
23
|
+
const mockUseGetBucketAcl = jest.mocked(useGetBucketAcl);
|
|
24
|
+
const mockUseGetBucketCors = jest.mocked(useGetBucketCors);
|
|
25
|
+
const mockUseGetBucketObjectLockConfiguration = jest.mocked(useGetBucketObjectLockConfiguration);
|
|
26
|
+
const mockUseGetBucketPolicy = jest.mocked(useGetBucketPolicy);
|
|
27
|
+
const mockUseGetBucketLocation = jest.mocked(useGetBucketLocation);
|
|
28
|
+
const mockUseGetBucketTagging = jest.mocked(useGetBucketTagging);
|
|
29
|
+
const mockUseISVBucketStatus = jest.mocked(useISVBucketStatus);
|
|
30
|
+
const mockUseFeatures = jest.mocked(useFeatures);
|
|
31
|
+
const mockUseDataBrowserUICustomization = (config = {})=>{
|
|
32
|
+
jest.spyOn(__rspack_external__contexts_DataBrowserUICustomizationContext_js_f267b01c, 'useDataBrowserUICustomization').mockReturnValue(config);
|
|
33
|
+
};
|
|
34
|
+
const renderBucketDetails = ()=>{
|
|
35
|
+
const Wrapper = createTestWrapper();
|
|
36
|
+
return render(/*#__PURE__*/ jsx(MemoryRouter, {
|
|
37
|
+
initialEntries: [
|
|
38
|
+
'/buckets/test-bucket'
|
|
39
|
+
],
|
|
40
|
+
children: /*#__PURE__*/ jsx(Wrapper, {
|
|
41
|
+
children: /*#__PURE__*/ jsx(BucketDetails, {})
|
|
42
|
+
})
|
|
43
|
+
}));
|
|
44
|
+
};
|
|
45
|
+
const mockHookDefaults = (overrides = {})=>{
|
|
46
|
+
applyBucketMocks({
|
|
47
|
+
useGetBucketVersioning: mockUseGetBucketVersioning,
|
|
48
|
+
useGetBucketAcl: mockUseGetBucketAcl,
|
|
49
|
+
useGetBucketLocation: mockUseGetBucketLocation,
|
|
50
|
+
useGetBucketCors: mockUseGetBucketCors,
|
|
51
|
+
useGetBucketObjectLockConfiguration: mockUseGetBucketObjectLockConfiguration,
|
|
52
|
+
useGetBucketPolicy: mockUseGetBucketPolicy,
|
|
53
|
+
useGetBucketTagging: mockUseGetBucketTagging,
|
|
54
|
+
useGetBucketLifecycle: mockUseGetBucketLifecycle,
|
|
55
|
+
useGetBucketReplication: mockUseGetBucketReplication,
|
|
56
|
+
useISVBucketStatus: mockUseISVBucketStatus,
|
|
57
|
+
useFeatures: mockUseFeatures
|
|
58
|
+
}, overrides);
|
|
59
|
+
};
|
|
60
|
+
describe('BucketDetails', ()=>{
|
|
61
|
+
beforeEach(()=>{
|
|
62
|
+
jest.clearAllMocks();
|
|
63
|
+
mockHookDefaults();
|
|
64
|
+
mockUseDataBrowserUICustomization({});
|
|
65
|
+
mockUseParams.mockReturnValue({
|
|
66
|
+
bucketName: 'test-bucket'
|
|
67
|
+
});
|
|
68
|
+
mockUseNavigate.mockReturnValue(jest.fn());
|
|
69
|
+
});
|
|
70
|
+
it('renders all default tabs', async ()=>{
|
|
71
|
+
renderBucketDetails();
|
|
72
|
+
await waitFor(()=>{
|
|
73
|
+
expect(screen.getByText('Overview')).toBeInTheDocument();
|
|
74
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
75
|
+
expect(screen.getByText('Replication')).toBeInTheDocument();
|
|
76
|
+
});
|
|
77
|
+
});
|
|
78
|
+
it('shows overview tab content by default', ()=>{
|
|
79
|
+
renderBucketDetails();
|
|
80
|
+
const overviewTab = screen.getByText('Overview').closest('[role="tab"]');
|
|
81
|
+
expect(overviewTab).toHaveAttribute('class', expect.stringContaining('selected'));
|
|
82
|
+
});
|
|
83
|
+
it('handles lifecycle data loading', ()=>{
|
|
84
|
+
mockUseGetBucketLifecycle.mockReturnValue({
|
|
85
|
+
data: void 0,
|
|
86
|
+
status: 'pending',
|
|
87
|
+
error: null
|
|
88
|
+
});
|
|
89
|
+
renderBucketDetails();
|
|
90
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
91
|
+
});
|
|
92
|
+
it('handles lifecycle error gracefully', ()=>{
|
|
93
|
+
mockUseGetBucketLifecycle.mockReturnValue({
|
|
94
|
+
data: void 0,
|
|
95
|
+
status: 'error',
|
|
96
|
+
error: new Error('Failed to fetch')
|
|
97
|
+
});
|
|
98
|
+
renderBucketDetails();
|
|
99
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
100
|
+
});
|
|
101
|
+
it('handles lifecycle 404 as success', ()=>{
|
|
102
|
+
const notFoundError = new Error('Not found');
|
|
103
|
+
notFoundError.name = 'NoSuchLifecycleConfiguration';
|
|
104
|
+
notFoundError.$metadata = {
|
|
105
|
+
httpStatusCode: 404
|
|
106
|
+
};
|
|
107
|
+
mockUseGetBucketLifecycle.mockReturnValue({
|
|
108
|
+
data: void 0,
|
|
109
|
+
status: 'error',
|
|
110
|
+
error: notFoundError
|
|
111
|
+
});
|
|
112
|
+
renderBucketDetails();
|
|
113
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
114
|
+
});
|
|
115
|
+
it('displays lifecycle rules when available', ()=>{
|
|
116
|
+
mockUseGetBucketLifecycle.mockReturnValue({
|
|
117
|
+
data: {
|
|
118
|
+
Rules: [
|
|
119
|
+
{
|
|
120
|
+
ID: 'rule-1',
|
|
121
|
+
Status: 'Enabled',
|
|
122
|
+
Filter: {}
|
|
123
|
+
},
|
|
124
|
+
{
|
|
125
|
+
ID: 'rule-2',
|
|
126
|
+
Status: 'Disabled',
|
|
127
|
+
Filter: {}
|
|
128
|
+
}
|
|
129
|
+
]
|
|
130
|
+
},
|
|
131
|
+
status: 'success',
|
|
132
|
+
error: null
|
|
133
|
+
});
|
|
134
|
+
renderBucketDetails();
|
|
135
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
136
|
+
});
|
|
137
|
+
it('handles replication data loading', ()=>{
|
|
138
|
+
mockUseGetBucketReplication.mockReturnValue({
|
|
139
|
+
data: void 0,
|
|
140
|
+
status: 'pending',
|
|
141
|
+
error: null
|
|
142
|
+
});
|
|
143
|
+
renderBucketDetails();
|
|
144
|
+
expect(screen.getByText('Replication')).toBeInTheDocument();
|
|
145
|
+
});
|
|
146
|
+
it('handles replication error gracefully', ()=>{
|
|
147
|
+
mockUseGetBucketReplication.mockReturnValue({
|
|
148
|
+
data: void 0,
|
|
149
|
+
status: 'error',
|
|
150
|
+
error: new Error('Failed to fetch')
|
|
151
|
+
});
|
|
152
|
+
renderBucketDetails();
|
|
153
|
+
expect(screen.getByText('Replication')).toBeInTheDocument();
|
|
154
|
+
});
|
|
155
|
+
it('handles replication 404 as success', ()=>{
|
|
156
|
+
const notFoundError = new Error('Not found');
|
|
157
|
+
notFoundError.name = 'ReplicationConfigurationNotFoundError';
|
|
158
|
+
notFoundError.$metadata = {
|
|
159
|
+
httpStatusCode: 404
|
|
160
|
+
};
|
|
161
|
+
mockUseGetBucketReplication.mockReturnValue({
|
|
162
|
+
data: void 0,
|
|
163
|
+
status: 'error',
|
|
164
|
+
error: notFoundError
|
|
165
|
+
});
|
|
166
|
+
renderBucketDetails();
|
|
167
|
+
expect(screen.getByText('Replication')).toBeInTheDocument();
|
|
168
|
+
});
|
|
169
|
+
it('displays replication rules when available', ()=>{
|
|
170
|
+
mockUseGetBucketReplication.mockReturnValue({
|
|
171
|
+
data: {
|
|
172
|
+
ReplicationConfiguration: {
|
|
173
|
+
Role: 'arn:aws:iam::123456789012:role/replication-role',
|
|
174
|
+
Rules: [
|
|
175
|
+
{
|
|
176
|
+
ID: 'repl-rule-1',
|
|
177
|
+
Status: 'Enabled',
|
|
178
|
+
Priority: 1,
|
|
179
|
+
Destination: {
|
|
180
|
+
Bucket: 'arn:aws:s3:::destination-bucket'
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
]
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
status: 'success',
|
|
187
|
+
error: null
|
|
188
|
+
});
|
|
189
|
+
renderBucketDetails();
|
|
190
|
+
expect(screen.getByText('Replication')).toBeInTheDocument();
|
|
191
|
+
});
|
|
192
|
+
it('shows message when bucket name is missing', ()=>{
|
|
193
|
+
mockUseParams.mockReturnValue({
|
|
194
|
+
bucketName: void 0
|
|
195
|
+
});
|
|
196
|
+
renderBucketDetails();
|
|
197
|
+
expect(screen.getByText('No bucket selected')).toBeInTheDocument();
|
|
198
|
+
});
|
|
199
|
+
describe('extraBucketTabs support', ()=>{
|
|
200
|
+
it('renders extra tabs when configured', async ()=>{
|
|
201
|
+
const CustomTab = ()=>/*#__PURE__*/ jsx("div", {
|
|
202
|
+
children: "Custom Tab Content"
|
|
203
|
+
});
|
|
204
|
+
mockUseDataBrowserUICustomization({
|
|
205
|
+
extraBucketTabs: [
|
|
206
|
+
{
|
|
207
|
+
id: 'customTab',
|
|
208
|
+
title: 'Custom Tab',
|
|
209
|
+
render: CustomTab
|
|
210
|
+
}
|
|
211
|
+
]
|
|
212
|
+
});
|
|
213
|
+
renderBucketDetails();
|
|
214
|
+
await waitFor(()=>{
|
|
215
|
+
expect(screen.getByText('Custom Tab')).toBeInTheDocument();
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
it('renders multiple extra tabs', async ()=>{
|
|
219
|
+
const Tab1 = ()=>/*#__PURE__*/ jsx("div", {
|
|
220
|
+
children: "Tab 1 Content"
|
|
221
|
+
});
|
|
222
|
+
const Tab2 = ()=>/*#__PURE__*/ jsx("div", {
|
|
223
|
+
children: "Tab 2 Content"
|
|
224
|
+
});
|
|
225
|
+
mockUseDataBrowserUICustomization({
|
|
226
|
+
extraBucketTabs: [
|
|
227
|
+
{
|
|
228
|
+
id: 'tab1',
|
|
229
|
+
title: 'Tab 1',
|
|
230
|
+
render: Tab1
|
|
231
|
+
},
|
|
232
|
+
{
|
|
233
|
+
id: 'tab2',
|
|
234
|
+
title: 'Tab 2',
|
|
235
|
+
render: Tab2
|
|
236
|
+
}
|
|
237
|
+
]
|
|
238
|
+
});
|
|
239
|
+
renderBucketDetails();
|
|
240
|
+
await waitFor(()=>{
|
|
241
|
+
expect(screen.getByText('Tab 1')).toBeInTheDocument();
|
|
242
|
+
expect(screen.getByText('Tab 2')).toBeInTheDocument();
|
|
243
|
+
});
|
|
244
|
+
});
|
|
245
|
+
it('can replace default tabs using matching IDs', async ()=>{
|
|
246
|
+
const CustomOverview = ()=>/*#__PURE__*/ jsx("div", {
|
|
247
|
+
children: "Custom Overview Content"
|
|
248
|
+
});
|
|
249
|
+
mockUseDataBrowserUICustomization({
|
|
250
|
+
extraBucketTabs: [
|
|
251
|
+
{
|
|
252
|
+
id: 'overview',
|
|
253
|
+
title: 'Custom Overview',
|
|
254
|
+
render: CustomOverview
|
|
255
|
+
}
|
|
256
|
+
]
|
|
257
|
+
});
|
|
258
|
+
renderBucketDetails();
|
|
259
|
+
await waitFor(()=>{
|
|
260
|
+
expect(screen.getByText('Custom Overview')).toBeInTheDocument();
|
|
261
|
+
expect(screen.queryByText('Overview')).not.toBeInTheDocument();
|
|
262
|
+
});
|
|
263
|
+
});
|
|
264
|
+
it('supports withoutPadding option for extra tabs', async ()=>{
|
|
265
|
+
const CustomTab = ()=>/*#__PURE__*/ jsx("div", {
|
|
266
|
+
children: "No Padding Content"
|
|
267
|
+
});
|
|
268
|
+
mockUseDataBrowserUICustomization({
|
|
269
|
+
extraBucketTabs: [
|
|
270
|
+
{
|
|
271
|
+
id: 'noPaddingTab',
|
|
272
|
+
title: 'No Padding',
|
|
273
|
+
withoutPadding: true,
|
|
274
|
+
render: CustomTab
|
|
275
|
+
}
|
|
276
|
+
]
|
|
277
|
+
});
|
|
278
|
+
renderBucketDetails();
|
|
279
|
+
await waitFor(()=>{
|
|
280
|
+
expect(screen.getByText('No Padding')).toBeInTheDocument();
|
|
281
|
+
});
|
|
282
|
+
});
|
|
283
|
+
it('supports custom path for extra tabs', async ()=>{
|
|
284
|
+
const CustomTab = ()=>/*#__PURE__*/ jsx("div", {
|
|
285
|
+
children: "Custom Path Content"
|
|
286
|
+
});
|
|
287
|
+
mockUseDataBrowserUICustomization({
|
|
288
|
+
extraBucketTabs: [
|
|
289
|
+
{
|
|
290
|
+
id: 'customPath',
|
|
291
|
+
title: 'Custom Path Tab',
|
|
292
|
+
path: '/custom-path',
|
|
293
|
+
render: CustomTab
|
|
294
|
+
}
|
|
295
|
+
]
|
|
296
|
+
});
|
|
297
|
+
renderBucketDetails();
|
|
298
|
+
await waitFor(()=>{
|
|
299
|
+
expect(screen.getByText('Custom Path Tab')).toBeInTheDocument();
|
|
300
|
+
});
|
|
301
|
+
});
|
|
302
|
+
it('maintains correct tab order with extra tabs', async ()=>{
|
|
303
|
+
const ExtraTab = ()=>/*#__PURE__*/ jsx("div", {
|
|
304
|
+
children: "Extra Tab Content"
|
|
305
|
+
});
|
|
306
|
+
mockUseDataBrowserUICustomization({
|
|
307
|
+
extraBucketTabs: [
|
|
308
|
+
{
|
|
309
|
+
id: 'extraTab',
|
|
310
|
+
title: 'Extra Tab',
|
|
311
|
+
render: ExtraTab
|
|
312
|
+
}
|
|
313
|
+
]
|
|
314
|
+
});
|
|
315
|
+
renderBucketDetails();
|
|
316
|
+
await waitFor(()=>{
|
|
317
|
+
const tabs = screen.getAllByRole('tab');
|
|
318
|
+
const tabTexts = tabs.map((tab)=>tab.textContent);
|
|
319
|
+
expect(tabTexts).toEqual([
|
|
320
|
+
'Overview',
|
|
321
|
+
'Lifecycle',
|
|
322
|
+
'Replication',
|
|
323
|
+
'Notification',
|
|
324
|
+
'Extra Tab'
|
|
325
|
+
]);
|
|
326
|
+
});
|
|
327
|
+
});
|
|
328
|
+
it('can replace lifecycle tab', async ()=>{
|
|
329
|
+
const CustomLifecycle = ()=>/*#__PURE__*/ jsx("div", {
|
|
330
|
+
children: "Custom Lifecycle Content"
|
|
331
|
+
});
|
|
332
|
+
mockUseDataBrowserUICustomization({
|
|
333
|
+
extraBucketTabs: [
|
|
334
|
+
{
|
|
335
|
+
id: 'lifecycle',
|
|
336
|
+
title: 'Custom Lifecycle',
|
|
337
|
+
render: CustomLifecycle
|
|
338
|
+
}
|
|
339
|
+
]
|
|
340
|
+
});
|
|
341
|
+
renderBucketDetails();
|
|
342
|
+
await waitFor(()=>{
|
|
343
|
+
expect(screen.getByText('Custom Lifecycle')).toBeInTheDocument();
|
|
344
|
+
expect(screen.queryByText('Lifecycle')).not.toBeInTheDocument();
|
|
345
|
+
});
|
|
346
|
+
});
|
|
347
|
+
it('can replace replication tab', async ()=>{
|
|
348
|
+
const CustomReplication = ()=>/*#__PURE__*/ jsx("div", {
|
|
349
|
+
children: "Custom Replication Content"
|
|
350
|
+
});
|
|
351
|
+
mockUseDataBrowserUICustomization({
|
|
352
|
+
extraBucketTabs: [
|
|
353
|
+
{
|
|
354
|
+
id: 'replication',
|
|
355
|
+
title: 'Custom Replication',
|
|
356
|
+
render: CustomReplication
|
|
357
|
+
}
|
|
358
|
+
]
|
|
359
|
+
});
|
|
360
|
+
renderBucketDetails();
|
|
361
|
+
await waitFor(()=>{
|
|
362
|
+
expect(screen.getByText('Custom Replication')).toBeInTheDocument();
|
|
363
|
+
expect(screen.queryByText('Replication')).not.toBeInTheDocument();
|
|
364
|
+
});
|
|
365
|
+
});
|
|
366
|
+
});
|
|
367
|
+
describe('Tab query parameters', ()=>{
|
|
368
|
+
it('creates correct query object for overview tab', ()=>{
|
|
369
|
+
renderBucketDetails();
|
|
370
|
+
const overviewTab = screen.getByText('Overview');
|
|
371
|
+
expect(overviewTab).toBeInTheDocument();
|
|
372
|
+
expect(overviewTab.closest('[role="tab"]')).toBeInTheDocument();
|
|
373
|
+
});
|
|
374
|
+
it('creates correct query object for lifecycle tab', ()=>{
|
|
375
|
+
renderBucketDetails();
|
|
376
|
+
const lifecycleTab = screen.getByText('Lifecycle');
|
|
377
|
+
expect(lifecycleTab).toBeInTheDocument();
|
|
378
|
+
expect(lifecycleTab.closest('[role="tab"]')).toBeInTheDocument();
|
|
379
|
+
});
|
|
380
|
+
it('creates correct query object for replication tab', ()=>{
|
|
381
|
+
renderBucketDetails();
|
|
382
|
+
const replicationTab = screen.getByText('Replication');
|
|
383
|
+
expect(replicationTab).toBeInTheDocument();
|
|
384
|
+
expect(replicationTab.closest('[role="tab"]')).toBeInTheDocument();
|
|
385
|
+
});
|
|
386
|
+
});
|
|
387
|
+
describe('Status transformation', ()=>{
|
|
388
|
+
it('transforms pending status to loading', ()=>{
|
|
389
|
+
mockUseGetBucketLifecycle.mockReturnValue({
|
|
390
|
+
data: void 0,
|
|
391
|
+
status: 'pending',
|
|
392
|
+
error: null
|
|
393
|
+
});
|
|
394
|
+
renderBucketDetails();
|
|
395
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
396
|
+
});
|
|
397
|
+
it('transforms error status correctly', ()=>{
|
|
398
|
+
mockUseGetBucketLifecycle.mockReturnValue({
|
|
399
|
+
data: void 0,
|
|
400
|
+
status: 'error',
|
|
401
|
+
error: new Error('Generic error')
|
|
402
|
+
});
|
|
403
|
+
renderBucketDetails();
|
|
404
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
405
|
+
});
|
|
406
|
+
it('transforms 404 error to success', ()=>{
|
|
407
|
+
const notFoundError = new Error('Not found');
|
|
408
|
+
notFoundError.name = 'NoSuchLifecycleConfiguration';
|
|
409
|
+
notFoundError.$metadata = {
|
|
410
|
+
httpStatusCode: 404
|
|
411
|
+
};
|
|
412
|
+
mockUseGetBucketLifecycle.mockReturnValue({
|
|
413
|
+
data: void 0,
|
|
414
|
+
status: 'error',
|
|
415
|
+
error: notFoundError
|
|
416
|
+
});
|
|
417
|
+
renderBucketDetails();
|
|
418
|
+
expect(screen.getByText('Lifecycle')).toBeInTheDocument();
|
|
419
|
+
});
|
|
420
|
+
});
|
|
421
|
+
});
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @fileoverview Comprehensive tests for BucketLifecycleFormPage component
|
|
3
|
+
*
|
|
4
|
+
* This test suite covers:
|
|
5
|
+
* - Page rendering (create/edit modes, loading states, error states)
|
|
6
|
+
* - Form fields (initial state, field visibility, conditional rendering)
|
|
7
|
+
* - Form validation (required fields, uniqueness, format validation)
|
|
8
|
+
* - Form submission (create/edit modes, success/error handling, navigation)
|
|
9
|
+
* - Rule data loading (various filter types, configurations)
|
|
10
|
+
* - Lifecycle actions (transitions, expirations, noncurrent versions)
|
|
11
|
+
*
|
|
12
|
+
* @see BucketLifecycleFormPage for the component implementation
|
|
13
|
+
*/
|
|
14
|
+
export {};
|