@scality/data-browser-library 1.0.0-preview.11 → 1.0.0-preview.15

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.
Files changed (212) hide show
  1. package/dist/components/DataBrowserUI.d.ts +27 -0
  2. package/dist/components/DataBrowserUI.js +88 -0
  3. package/dist/components/Editor.d.ts +1 -1
  4. package/dist/components/Editor.js +3 -3
  5. package/dist/components/__tests__/BucketCreate.test.js +102 -102
  6. package/dist/components/__tests__/BucketDetails.test.d.ts +1 -0
  7. package/dist/components/__tests__/BucketDetails.test.js +420 -0
  8. package/dist/components/__tests__/BucketLifecycleFormPage.test.js +177 -177
  9. package/dist/components/__tests__/BucketLifecycleList.test.js +85 -85
  10. package/dist/components/__tests__/BucketList.test.js +463 -239
  11. package/dist/components/__tests__/BucketNotificationCreatePage.test.js +84 -84
  12. package/dist/components/__tests__/BucketOverview.test.js +273 -261
  13. package/dist/components/__tests__/BucketPolicyPage.test.js +62 -62
  14. package/dist/components/__tests__/BucketReplicationFormPage.test.js +542 -542
  15. package/dist/components/__tests__/BucketReplicationList.test.js +106 -106
  16. package/dist/components/__tests__/CreateFolderButton.test.js +56 -56
  17. package/dist/components/__tests__/DeleteBucketButton.test.js +62 -62
  18. package/dist/components/__tests__/DeleteBucketConfigRuleButton.test.js +47 -47
  19. package/dist/components/__tests__/DeleteObjectButton.test.js +63 -63
  20. package/dist/components/__tests__/EmptyBucketButton.test.js +56 -56
  21. package/dist/components/__tests__/MetadataSearch.test.js +65 -65
  22. package/dist/components/__tests__/ObjectList.test.js +739 -238
  23. package/dist/components/__tests__/UploadButton.test.js +45 -45
  24. package/dist/components/buckets/BucketCreate.d.ts +2 -2
  25. package/dist/components/buckets/BucketCreate.js +41 -41
  26. package/dist/components/buckets/BucketDetails.d.ts +40 -0
  27. package/dist/components/buckets/BucketDetails.js +208 -88
  28. package/dist/components/buckets/BucketLifecycleFormPage.js +161 -160
  29. package/dist/components/buckets/BucketLifecycleList.d.ts +2 -2
  30. package/dist/components/buckets/BucketLifecycleList.js +46 -46
  31. package/dist/components/buckets/BucketList.d.ts +7 -8
  32. package/dist/components/buckets/BucketList.js +156 -100
  33. package/dist/components/buckets/BucketLocation.js +3 -3
  34. package/dist/components/buckets/BucketOverview.d.ts +7 -1
  35. package/dist/components/buckets/BucketOverview.js +366 -182
  36. package/dist/components/buckets/BucketPage.js +20 -16
  37. package/dist/components/buckets/BucketPolicyButton.js +2 -2
  38. package/dist/components/buckets/BucketPolicyPage.js +27 -25
  39. package/dist/components/buckets/BucketReplicationFormPage.js +133 -132
  40. package/dist/components/buckets/BucketReplicationList.d.ts +2 -2
  41. package/dist/components/buckets/BucketReplicationList.js +41 -41
  42. package/dist/components/buckets/BucketVersioning.js +13 -10
  43. package/dist/components/buckets/DeleteBucketButton.js +5 -5
  44. package/dist/components/buckets/DeleteBucketConfigRuleButton.d.ts +2 -2
  45. package/dist/components/buckets/DeleteBucketConfigRuleButton.js +1 -1
  46. package/dist/components/buckets/EmptyBucketButton.js +20 -20
  47. package/dist/components/buckets/EmptyBucketSummary.d.ts +1 -1
  48. package/dist/components/buckets/EmptyBucketSummary.js +1 -1
  49. package/dist/components/buckets/EmptyBucketSummaryList.js +22 -22
  50. package/dist/components/buckets/__tests__/BucketVersioning.test.js +45 -45
  51. package/dist/components/buckets/notifications/BucketNotificationCreatePage.js +34 -33
  52. package/dist/components/buckets/notifications/EventsSection.js +144 -28
  53. package/dist/components/buckets/notifications/__tests__/events.test.d.ts +1 -0
  54. package/dist/components/buckets/notifications/__tests__/events.test.js +56 -0
  55. package/dist/components/buckets/notifications/events.d.ts +71 -7
  56. package/dist/components/buckets/notifications/events.js +98 -16
  57. package/dist/components/index.d.ts +23 -21
  58. package/dist/components/index.js +4 -2
  59. package/dist/components/layouts/ArrowNavigation.d.ts +1 -2
  60. package/dist/components/layouts/ArrowNavigation.js +22 -10
  61. package/dist/components/layouts/BrowserPageLayout.d.ts +2 -3
  62. package/dist/components/layouts/BrowserPageLayout.js +1 -1
  63. package/dist/components/objects/CreateFolderButton.d.ts +2 -2
  64. package/dist/components/objects/CreateFolderButton.js +10 -10
  65. package/dist/components/objects/DeleteObjectButton.d.ts +1 -1
  66. package/dist/components/objects/DeleteObjectButton.js +20 -20
  67. package/dist/components/objects/ObjectDetails/ObjectMetadata.d.ts +1 -1
  68. package/dist/components/objects/ObjectDetails/ObjectMetadata.js +56 -56
  69. package/dist/components/objects/ObjectDetails/ObjectSummary.d.ts +1 -1
  70. package/dist/components/objects/ObjectDetails/ObjectSummary.js +294 -164
  71. package/dist/components/objects/ObjectDetails/ObjectTags.d.ts +1 -1
  72. package/dist/components/objects/ObjectDetails/ObjectTags.js +25 -25
  73. package/dist/components/objects/ObjectDetails/__tests__/ObjectDetails.test.d.ts +1 -0
  74. package/dist/components/objects/ObjectDetails/__tests__/ObjectDetails.test.js +516 -0
  75. package/dist/components/objects/ObjectDetails/__tests__/ObjectSummary.test.d.ts +1 -0
  76. package/dist/components/objects/ObjectDetails/__tests__/ObjectSummary.test.js +813 -0
  77. package/dist/components/objects/ObjectDetails/index.d.ts +17 -1
  78. package/dist/components/objects/ObjectDetails/index.js +136 -50
  79. package/dist/components/objects/ObjectList.d.ts +11 -9
  80. package/dist/components/objects/ObjectList.js +576 -295
  81. package/dist/components/objects/ObjectLock/EditRetentionButton.js +3 -3
  82. package/dist/components/objects/ObjectLock/ObjectLockRetentionSettings.js +14 -14
  83. package/dist/components/objects/ObjectLock/ObjectLockSettings.d.ts +1 -1
  84. package/dist/components/objects/ObjectLock/ObjectLockSettings.js +29 -28
  85. package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.d.ts +1 -1
  86. package/dist/components/objects/ObjectLock/ObjectLockSettingsUtils.js +6 -6
  87. package/dist/components/objects/ObjectLock/__tests__/EditRetentionButton.test.js +50 -50
  88. package/dist/components/objects/ObjectLock/__tests__/ObjectLockSettings.test.js +77 -77
  89. package/dist/components/objects/ObjectPage.js +5 -4
  90. package/dist/components/objects/UploadButton.d.ts +3 -3
  91. package/dist/components/objects/UploadButton.js +6 -6
  92. package/dist/components/providers/DataBrowserProvider.d.ts +15 -4
  93. package/dist/components/providers/DataBrowserProvider.js +33 -11
  94. package/dist/components/search/MetadataSearch.js +26 -25
  95. package/dist/components/search/SearchHints.js +1 -1
  96. package/dist/components/ui/ArrayFieldActions.js +4 -4
  97. package/dist/components/ui/ConfirmDeleteRuleModal.d.ts +1 -1
  98. package/dist/components/ui/ConfirmDeleteRuleModal.js +1 -1
  99. package/dist/components/ui/DeleteObjectModalContent.d.ts +1 -1
  100. package/dist/components/ui/DeleteObjectModalContent.js +12 -12
  101. package/dist/components/ui/FilterFormSection.d.ts +2 -2
  102. package/dist/components/ui/FilterFormSection.js +29 -29
  103. package/dist/components/ui/Search.elements.d.ts +1 -1
  104. package/dist/components/ui/Search.elements.js +7 -7
  105. package/dist/components/ui/Table.elements.js +5 -5
  106. package/dist/config/factory.d.ts +23 -10
  107. package/dist/config/factory.js +22 -7
  108. package/dist/config/types.d.ts +134 -0
  109. package/dist/contexts/DataBrowserUICustomizationContext.d.ts +27 -0
  110. package/dist/contexts/DataBrowserUICustomizationContext.js +13 -0
  111. package/dist/hooks/__tests__/useISVBucketDetection.test.js +41 -41
  112. package/dist/hooks/__tests__/useIsBucketEmpty.test.js +25 -25
  113. package/dist/hooks/bucketConfiguration.d.ts +1 -1
  114. package/dist/hooks/bucketConfiguration.js +48 -48
  115. package/dist/hooks/bucketOperations.d.ts +1 -1
  116. package/dist/hooks/bucketOperations.js +6 -6
  117. package/dist/hooks/factories/__tests__/useCreateS3FunctionMutationHook.test.js +78 -78
  118. package/dist/hooks/factories/__tests__/useCreateS3InfiniteQueryHook.test.js +78 -78
  119. package/dist/hooks/factories/__tests__/useCreateS3LoginHook.test.js +42 -42
  120. package/dist/hooks/factories/__tests__/useCreateS3MutationHook.test.js +61 -61
  121. package/dist/hooks/factories/__tests__/useCreateS3QueryHook.test.js +63 -63
  122. package/dist/hooks/factories/index.d.ts +4 -4
  123. package/dist/hooks/factories/useCreateS3InfiniteQueryHook.d.ts +2 -2
  124. package/dist/hooks/factories/useCreateS3InfiniteQueryHook.js +15 -12
  125. package/dist/hooks/factories/useCreateS3LoginHook.d.ts +2 -2
  126. package/dist/hooks/factories/useCreateS3MutationHook.d.ts +3 -3
  127. package/dist/hooks/factories/useCreateS3MutationHook.js +6 -1
  128. package/dist/hooks/factories/useCreateS3QueryHook.d.ts +2 -2
  129. package/dist/hooks/factories/useCreateS3QueryHook.js +8 -5
  130. package/dist/hooks/index.d.ts +14 -13
  131. package/dist/hooks/index.js +2 -1
  132. package/dist/hooks/loginOperations.d.ts +1 -1
  133. package/dist/hooks/loginOperations.js +1 -1
  134. package/dist/hooks/objectOperations.d.ts +2 -2
  135. package/dist/hooks/objectOperations.js +49 -49
  136. package/dist/hooks/presignedOperations.d.ts +2 -2
  137. package/dist/hooks/presignedOperations.js +3 -3
  138. package/dist/hooks/useBatchObjectLegalHold.js +7 -4
  139. package/dist/hooks/useDataBrowserNavigate.d.ts +14 -0
  140. package/dist/hooks/useDataBrowserNavigate.js +24 -0
  141. package/dist/hooks/useDeleteBucketConfigRule.d.ts +2 -2
  142. package/dist/hooks/useDeleteBucketConfigRule.js +4 -4
  143. package/dist/hooks/useEmptyBucket.js +10 -10
  144. package/dist/hooks/useISVBucketDetection.js +3 -3
  145. package/dist/hooks/useIsBucketEmpty.js +4 -4
  146. package/dist/hooks/useLoginMutation.d.ts +1 -1
  147. package/dist/hooks/useLoginMutation.js +1 -1
  148. package/dist/hooks/useS3Client.d.ts +5 -0
  149. package/dist/hooks/useS3Client.js +3 -2
  150. package/dist/hooks/useS3ConfigSwitch.d.ts +11 -0
  151. package/dist/hooks/useS3ConfigSwitch.js +37 -0
  152. package/dist/index.d.ts +6 -6
  153. package/dist/test/msw/handlers/deleteBucket.d.ts +1 -1
  154. package/dist/test/msw/handlers/deleteBucket.js +20 -10
  155. package/dist/test/msw/handlers/getBucketAcl.d.ts +1 -1
  156. package/dist/test/msw/handlers/getBucketAcl.js +29 -17
  157. package/dist/test/msw/handlers/getBucketLocation.d.ts +1 -1
  158. package/dist/test/msw/handlers/getBucketLocation.js +29 -15
  159. package/dist/test/msw/handlers/getBucketPolicy.d.ts +1 -1
  160. package/dist/test/msw/handlers/getBucketPolicy.js +52 -32
  161. package/dist/test/msw/handlers/headObject.d.ts +1 -1
  162. package/dist/test/msw/handlers/headObject.js +31 -13
  163. package/dist/test/msw/handlers/listBuckets.d.ts +1 -1
  164. package/dist/test/msw/handlers/listBuckets.js +5 -3
  165. package/dist/test/msw/handlers/listObjectVersions.d.ts +1 -1
  166. package/dist/test/msw/handlers/listObjectVersions.js +38 -26
  167. package/dist/test/msw/handlers/listObjects.d.ts +1 -1
  168. package/dist/test/msw/handlers/listObjects.js +35 -23
  169. package/dist/test/msw/handlers/objectLegalHold.d.ts +1 -1
  170. package/dist/test/msw/handlers/objectLegalHold.js +31 -16
  171. package/dist/test/msw/handlers/objectRetention.d.ts +1 -1
  172. package/dist/test/msw/handlers/objectRetention.js +31 -17
  173. package/dist/test/msw/handlers/putBucketAcl.d.ts +1 -1
  174. package/dist/test/msw/handlers/putBucketAcl.js +29 -14
  175. package/dist/test/msw/handlers/putObject.d.ts +1 -1
  176. package/dist/test/msw/handlers/putObject.js +27 -12
  177. package/dist/test/msw/handlers.d.ts +3 -3
  178. package/dist/test/msw/handlers.js +72 -49
  179. package/dist/test/msw/index.d.ts +2 -2
  180. package/dist/test/msw/server.d.ts +1 -1
  181. package/dist/test/msw/server.js +1 -1
  182. package/dist/test/msw/utils.js +2 -2
  183. package/dist/test/setup.d.ts +1 -1
  184. package/dist/test/setup.js +19 -19
  185. package/dist/test/testUtils.d.ts +70 -12
  186. package/dist/test/testUtils.js +160 -75
  187. package/dist/test/utils/errorHandling.test.js +119 -119
  188. package/dist/types/index.d.ts +8 -31
  189. package/dist/utils/__tests__/s3ConfigIdentifier.test.d.ts +1 -0
  190. package/dist/utils/__tests__/s3ConfigIdentifier.test.js +429 -0
  191. package/dist/utils/constants.d.ts +7 -0
  192. package/dist/utils/constants.js +16 -9
  193. package/dist/utils/deletion/index.d.ts +2 -2
  194. package/dist/utils/deletion/messages.d.ts +1 -1
  195. package/dist/utils/deletion/messages.js +4 -4
  196. package/dist/utils/errorHandling.d.ts +3 -3
  197. package/dist/utils/errorHandling.js +6 -6
  198. package/dist/utils/hooks.js +8 -8
  199. package/dist/utils/index.d.ts +5 -4
  200. package/dist/utils/index.js +2 -0
  201. package/dist/utils/proxyMiddleware.d.ts +1 -1
  202. package/dist/utils/proxyMiddleware.js +6 -11
  203. package/dist/utils/s3Client.d.ts +2 -2
  204. package/dist/utils/s3Client.js +1 -1
  205. package/dist/utils/s3ConfigIdentifier.d.ts +68 -0
  206. package/dist/utils/s3ConfigIdentifier.js +55 -0
  207. package/dist/utils/s3RuleUtils.d.ts +5 -5
  208. package/dist/utils/s3RuleUtils.js +17 -17
  209. package/dist/utils/useFeatures.js +1 -1
  210. package/dist/utils/useSupportedNotificationEvents.d.ts +6 -0
  211. package/dist/utils/useSupportedNotificationEvents.js +7 -0
  212. package/package.json +3 -3
@@ -1,12 +1,13 @@
1
1
  import { jsx } from "react/jsx-runtime";
2
2
  import "react";
3
3
  import { PutObjectCommand, S3Client } from "@aws-sdk/client-s3";
4
- import { QueryClient, QueryClientProvider } from "@tanstack/react-query";
4
+ import { QueryClient } from "@tanstack/react-query";
5
5
  import { fireEvent, renderHook, screen, waitFor } from "@testing-library/react";
6
6
  import { coreUIAvailableThemes } from "@scality/core-ui/dist/style/theme";
7
7
  import { CoreUiThemeProvider } from "@scality/core-ui/dist/next";
8
8
  import { ToastProvider } from "@scality/core-ui";
9
9
  import { DataBrowserProvider } from "../components/providers/DataBrowserProvider.js";
10
+ import { DataBrowserUICustomizationProvider } from "../contexts/DataBrowserUICustomizationContext.js";
10
11
  import { overrideHandlers, setupMswServer } from "./msw/index.js";
11
12
  var __webpack_require__ = {};
12
13
  (()=>{
@@ -20,14 +21,14 @@ var __webpack_require__ = {};
20
21
  })();
21
22
  })();
22
23
  const testConfig = {
23
- endpoint: "https://s3.amazonaws.com",
24
- region: "us-east-1",
24
+ endpoint: 'https://s3.amazonaws.com',
25
+ region: 'us-east-1',
25
26
  forcePathStyle: true
26
27
  };
27
28
  const testCredentials = {
28
- accessKeyId: "test-access-key",
29
- secretAccessKey: "test-secret-key",
30
- sessionToken: "test-session-token"
29
+ accessKeyId: 'test-access-key',
30
+ secretAccessKey: 'test-secret-key',
31
+ sessionToken: 'test-session-token'
31
32
  };
32
33
  const mockS3Client = {
33
34
  send: jest.fn()
@@ -81,44 +82,24 @@ function mockOffsetSize(width, height) {
81
82
  }
82
83
  });
83
84
  const mockComputedStyle = {
84
- fontSize: "14px",
85
- paddingLeft: "0px",
86
- paddingRight: "0px",
87
- paddingTop: "0px",
88
- paddingBottom: "0px",
85
+ fontSize: '14px',
86
+ paddingLeft: '0px',
87
+ paddingRight: '0px',
88
+ paddingTop: '0px',
89
+ paddingBottom: '0px',
89
90
  getPropertyValue: jest.fn((prop)=>{
90
91
  const styles = {
91
- "font-size": "14px",
92
- "padding-left": "0px",
93
- "padding-right": "0px",
94
- "padding-top": "0px",
95
- "padding-bottom": "0px"
92
+ 'font-size': '14px',
93
+ 'padding-left': '0px',
94
+ 'padding-right': '0px',
95
+ 'padding-top': '0px',
96
+ 'padding-bottom': '0px'
96
97
  };
97
- return styles[prop] || "";
98
+ return styles[prop] || '';
98
99
  })
99
100
  };
100
- jest.spyOn(window, "getComputedStyle").mockImplementation(()=>mockComputedStyle);
101
+ jest.spyOn(window, 'getComputedStyle').mockImplementation(()=>mockComputedStyle);
101
102
  }
102
- const createQueryWrapper = ()=>{
103
- const queryClient = new QueryClient({
104
- defaultOptions: {
105
- queries: {
106
- retry: false
107
- },
108
- mutations: {
109
- retry: false
110
- }
111
- }
112
- });
113
- const theme = coreUIAvailableThemes.darkRebrand;
114
- return ({ children })=>/*#__PURE__*/ jsx(QueryClientProvider, {
115
- client: queryClient,
116
- children: /*#__PURE__*/ jsx(CoreUiThemeProvider, {
117
- theme: theme,
118
- children: children
119
- })
120
- });
121
- };
122
103
  const createTestWrapper = (config = testConfig, credentials = testCredentials)=>{
123
104
  const queryClient = new QueryClient({
124
105
  defaultOptions: {
@@ -140,10 +121,15 @@ const createTestWrapper = (config = testConfig, credentials = testCredentials)=>
140
121
  getS3Config: getConfig,
141
122
  theme: theme,
142
123
  enableDevtools: false,
143
- children: /*#__PURE__*/ jsx(CoreUiThemeProvider, {
144
- theme: theme,
145
- children: /*#__PURE__*/ jsx(ToastProvider, {
146
- children: children
124
+ children: /*#__PURE__*/ jsx(DataBrowserUICustomizationProvider, {
125
+ config: {
126
+ basePath: ''
127
+ },
128
+ children: /*#__PURE__*/ jsx(CoreUiThemeProvider, {
129
+ theme: theme,
130
+ children: /*#__PURE__*/ jsx(ToastProvider, {
131
+ children: children
132
+ })
147
133
  })
148
134
  })
149
135
  });
@@ -155,7 +141,7 @@ const renderHookWithWrapper = (hook, options)=>{
155
141
  ...renderOptions
156
142
  });
157
143
  };
158
- const createTestFile = (name, content, type = "text/plain")=>new File([
144
+ const createTestFile = (name, content, type = 'text/plain')=>new File([
159
145
  content
160
146
  ], name, {
161
147
  type
@@ -178,16 +164,16 @@ const overrideGlobalConfig = (overrides)=>{
178
164
  };
179
165
  const resetGlobalConfig = ()=>{
180
166
  globalThis.__S3_CONFIG__ = {
181
- endpoint: "http://localhost:8000",
182
- region: "us-east-1",
183
- realHost: "s3.amazonaws.com",
167
+ endpoint: 'http://localhost:8000',
168
+ region: 'us-east-1',
169
+ realHost: 's3.amazonaws.com',
184
170
  forcePathStyle: true
185
171
  };
186
172
  globalThis.__DEV_CONFIG__ = {
187
173
  useProxy: false,
188
- proxyEndpoint: "http://localhost:3000/api/s3",
189
- proxyBasePath: "/api/s3",
190
- proxyHost: "localhost",
174
+ proxyEndpoint: 'http://localhost:3000/api/s3',
175
+ proxyBasePath: '/api/s3',
176
+ proxyHost: 'localhost',
191
177
  proxyPort: 3000
192
178
  };
193
179
  globalThis.__IS_DEVELOPMENT__ = true;
@@ -201,37 +187,37 @@ const withGlobalConfig = (overrides, testFn)=>async ()=>{
201
187
  resetGlobalConfig();
202
188
  }
203
189
  };
204
- const createFactoryTestError = (testContext, operationName, details)=>new Error(`Factory Test Failure [${testContext}]: ${operationName} - ${details || "Unknown error"}. Check factory implementation and hook usage patterns.`);
190
+ const createFactoryTestError = (testContext, operationName, details)=>new Error(`Factory Test Failure [${testContext}]: ${operationName} - ${details || 'Unknown error'}. Check factory implementation and hook usage patterns.`);
205
191
  const validateFactoryHook = (hook, operationName)=>{
206
- if ("function" != typeof hook) throw createFactoryTestError("Factory Validation", operationName, "hook should be a function - check if useCreate*Hook factory is properly returning a hook function");
192
+ if ('function' != typeof hook) throw createFactoryTestError('Factory Validation', operationName, 'hook should be a function - check if useCreate*Hook factory is properly returning a hook function');
207
193
  };
208
194
  const validateHookResult = (result, hookType)=>{
209
195
  const commonProps = [
210
- "isError",
211
- "isSuccess",
212
- "data",
213
- "error"
196
+ 'isError',
197
+ 'isSuccess',
198
+ 'data',
199
+ 'error'
214
200
  ];
215
201
  const queryProps = [
216
- "isLoading"
202
+ 'isLoading'
217
203
  ];
218
204
  const mutationProps = [
219
- "mutate",
220
- "mutateAsync",
221
- "isPending"
205
+ 'mutate',
206
+ 'mutateAsync',
207
+ 'isPending'
222
208
  ];
223
209
  const infiniteProps = [
224
- "hasNextPage",
225
- "fetchNextPage",
226
- "isFetchingNextPage"
210
+ 'hasNextPage',
211
+ 'fetchNextPage',
212
+ 'isFetchingNextPage'
227
213
  ];
228
214
  const expectedProps = [
229
215
  ...commonProps,
230
- ..."query" === hookType ? queryProps : [],
231
- ..."mutation" === hookType ? mutationProps : [],
232
- ..."infiniteQuery" === hookType ? infiniteProps : []
216
+ ...'query' === hookType ? queryProps : [],
217
+ ...'mutation' === hookType ? mutationProps : [],
218
+ ...'infiniteQuery' === hookType ? infiniteProps : []
233
219
  ];
234
- for (const prop of expectedProps)if (!(prop in result)) throw createFactoryTestError("Hook Validation", hookType, `Missing property '${prop}' - check if factory is returning proper React Query hook result`);
220
+ for (const prop of expectedProps)if (!(prop in result)) throw createFactoryTestError('Hook Validation', hookType, `Missing property '${prop}' - check if factory is returning proper React Query hook result`);
235
221
  };
236
222
  const createMockMutationResult = (mutate, overrides = {})=>({
237
223
  mutate,
@@ -241,7 +227,7 @@ const createMockMutationResult = (mutate, overrides = {})=>({
241
227
  isIdle: true,
242
228
  isError: false,
243
229
  isSuccess: false,
244
- status: "idle",
230
+ status: 'idle',
245
231
  data: void 0,
246
232
  error: null,
247
233
  variables: void 0,
@@ -260,7 +246,7 @@ const createMockQueryResult = (overrides = {})=>({
260
246
  isLoadingError: false,
261
247
  isRefetchError: false,
262
248
  isSuccess: false,
263
- status: "pending",
249
+ status: 'pending',
264
250
  dataUpdatedAt: 0,
265
251
  errorUpdatedAt: 0,
266
252
  failureCount: 0,
@@ -284,15 +270,15 @@ const findToggleByLabel = (labelText)=>{
284
270
  while(current && !current.querySelector('input[type="checkbox"]'))current = current.parentElement;
285
271
  return current?.querySelector('input[type="checkbox"]');
286
272
  };
287
- const submitForm = async (buttonName = "create")=>{
273
+ const submitForm = async (buttonName = 'create')=>{
288
274
  await waitFor(()=>{
289
- const button = screen.getByRole("button", {
290
- name: "create" === buttonName ? /create/i : /save/i
275
+ const button = screen.getByRole('button', {
276
+ name: 'create' === buttonName ? /create/i : /save/i
291
277
  });
292
278
  expect(button).toBeEnabled();
293
279
  });
294
- const button = screen.getByRole("button", {
295
- name: "create" === buttonName ? /create/i : /save/i
280
+ const button = screen.getByRole('button', {
281
+ name: 'create' === buttonName ? /create/i : /save/i
296
282
  });
297
283
  fireEvent.click(button);
298
284
  };
@@ -301,10 +287,109 @@ const mockSuccessSubmit = (mockMutate)=>{
301
287
  options?.onSuccess?.();
302
288
  });
303
289
  };
304
- const mockErrorSubmit = (mockMutate, errorMessage = "Network Error")=>{
290
+ const mockErrorSubmit = (mockMutate, errorMessage = 'Network Error')=>{
305
291
  const error = new Error(errorMessage);
306
292
  mockMutate.mockImplementation((_, options)=>{
307
293
  options?.onError?.(error);
308
294
  });
309
295
  };
310
- export { MockedPutObjectCommand, MockedS3Client, createFactoryTestError, createMockMutationResult, createMockQueryResult, createQueryWrapper, createTestFile, createTestWrapper, findToggleByLabel, mockErrorSubmit, mockOffsetSize, mockS3Client, mockSuccessSubmit, overrideGlobalConfig, overrideHandlers, renderHookWithWrapper, resetGlobalConfig, setupCommonMocks, setupMswServer, setupS3Mocks, submitForm, testConfig, testCredentials, validateFactoryHook, validateHookResult, withGlobalConfig };
296
+ const createDefaultBucketMocks = ()=>({
297
+ versioning: {
298
+ data: {
299
+ Status: 'Enabled'
300
+ },
301
+ status: 'success'
302
+ },
303
+ acl: {
304
+ data: {
305
+ Owner: {
306
+ DisplayName: 'test-owner'
307
+ },
308
+ Grants: [
309
+ {
310
+ Grantee: {
311
+ Type: 'CanonicalUser',
312
+ DisplayName: 'test-grantee'
313
+ }
314
+ }
315
+ ]
316
+ },
317
+ status: 'success'
318
+ },
319
+ location: {
320
+ data: {
321
+ LocationConstraint: 'us-west-2'
322
+ },
323
+ status: 'success'
324
+ },
325
+ cors: {
326
+ data: {
327
+ CORSRules: []
328
+ },
329
+ status: 'success'
330
+ },
331
+ objectLock: {
332
+ data: {
333
+ ObjectLockConfiguration: {
334
+ ObjectLockEnabled: 'Disabled'
335
+ }
336
+ },
337
+ status: 'success'
338
+ },
339
+ policy: {
340
+ data: void 0,
341
+ error: null,
342
+ status: 'success'
343
+ },
344
+ tagging: {
345
+ data: {
346
+ TagSet: []
347
+ },
348
+ status: 'success'
349
+ },
350
+ lifecycle: {
351
+ data: {
352
+ Rules: []
353
+ },
354
+ status: 'success',
355
+ error: null
356
+ },
357
+ replication: {
358
+ data: {
359
+ ReplicationConfiguration: {
360
+ Role: 'arn:aws:iam::123456789012:role/replication-role',
361
+ Rules: []
362
+ }
363
+ },
364
+ status: 'success',
365
+ error: null
366
+ },
367
+ isvBucketStatus: {
368
+ isVeeamBucket: false,
369
+ isCommvaultBucket: false,
370
+ isISVManaged: false,
371
+ isvApplication: void 0,
372
+ isLoading: false,
373
+ bucketTagsStatus: 'success'
374
+ },
375
+ features: false
376
+ });
377
+ const applyBucketMocks = (mocks, mockData = {})=>{
378
+ const defaults = createDefaultBucketMocks();
379
+ const data = {
380
+ ...defaults,
381
+ ...mockData
382
+ };
383
+ mocks.useGetBucketVersioning.mockReturnValue(data.versioning);
384
+ mocks.useGetBucketAcl.mockReturnValue(data.acl);
385
+ mocks.useGetBucketLocation.mockReturnValue(data.location);
386
+ mocks.useGetBucketCors.mockReturnValue(data.cors);
387
+ mocks.useGetBucketObjectLockConfiguration.mockReturnValue(data.objectLock);
388
+ mocks.useGetBucketPolicy.mockReturnValue(data.policy);
389
+ mocks.useGetBucketTagging.mockReturnValue(data.tagging);
390
+ mocks.useISVBucketStatus.mockReturnValue(data.isvBucketStatus);
391
+ mocks.useFeatures.mockReturnValue(data.features);
392
+ if (mocks.useGetBucketLifecycle) mocks.useGetBucketLifecycle.mockReturnValue(data.lifecycle);
393
+ if (mocks.useGetBucketReplication) mocks.useGetBucketReplication.mockReturnValue(data.replication);
394
+ };
395
+ export { MockedPutObjectCommand, MockedS3Client, applyBucketMocks, createDefaultBucketMocks, createFactoryTestError, createMockMutationResult, createMockQueryResult, createTestFile, createTestWrapper, findToggleByLabel, mockErrorSubmit, mockOffsetSize, mockS3Client, mockSuccessSubmit, overrideGlobalConfig, overrideHandlers, renderHookWithWrapper, resetGlobalConfig, setupCommonMocks, setupMswServer, setupS3Mocks, submitForm, testConfig, testCredentials, validateFactoryHook, validateHookResult, withGlobalConfig };