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

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 (40) hide show
  1. package/dist/components/DataBrowserUI.d.ts +20 -0
  2. package/dist/components/DataBrowserUI.js +64 -0
  3. package/dist/components/__tests__/BucketDetails.test.d.ts +1 -0
  4. package/dist/components/__tests__/BucketDetails.test.js +421 -0
  5. package/dist/components/__tests__/BucketList.test.js +389 -164
  6. package/dist/components/__tests__/BucketOverview.test.js +19 -63
  7. package/dist/components/__tests__/ObjectList.test.js +719 -219
  8. package/dist/components/buckets/BucketDetails.d.ts +40 -0
  9. package/dist/components/buckets/BucketDetails.js +194 -86
  10. package/dist/components/buckets/BucketList.d.ts +5 -6
  11. package/dist/components/buckets/BucketList.js +152 -97
  12. package/dist/components/buckets/BucketOverview.d.ts +6 -0
  13. package/dist/components/buckets/BucketOverview.js +363 -179
  14. package/dist/components/buckets/BucketPage.js +1 -5
  15. package/dist/components/buckets/BucketVersioning.js +3 -0
  16. package/dist/components/buckets/EmptyBucketButton.js +1 -1
  17. package/dist/components/index.d.ts +2 -1
  18. package/dist/components/index.js +2 -1
  19. package/dist/components/layouts/ArrowNavigation.js +20 -8
  20. package/dist/components/objects/CreateFolderButton.js +1 -1
  21. package/dist/components/objects/ObjectDetails/ObjectSummary.js +287 -157
  22. package/dist/components/objects/ObjectDetails/__tests__/ObjectDetails.test.d.ts +1 -0
  23. package/dist/components/objects/ObjectDetails/__tests__/ObjectDetails.test.js +516 -0
  24. package/dist/components/objects/ObjectDetails/__tests__/ObjectSummary.test.d.ts +1 -0
  25. package/dist/components/objects/ObjectDetails/__tests__/ObjectSummary.test.js +813 -0
  26. package/dist/components/objects/ObjectDetails/index.d.ts +16 -0
  27. package/dist/components/objects/ObjectDetails/index.js +132 -46
  28. package/dist/components/objects/ObjectList.d.ts +7 -5
  29. package/dist/components/objects/ObjectList.js +566 -286
  30. package/dist/components/objects/UploadButton.js +1 -1
  31. package/dist/config/types.d.ts +117 -0
  32. package/dist/contexts/DataBrowserUICustomizationContext.d.ts +27 -0
  33. package/dist/contexts/DataBrowserUICustomizationContext.js +13 -0
  34. package/dist/test/testUtils.d.ts +64 -0
  35. package/dist/test/testUtils.js +100 -1
  36. package/dist/types/index.d.ts +5 -3
  37. package/dist/utils/constants.d.ts +7 -0
  38. package/dist/utils/constants.js +8 -1
  39. package/dist/utils/useFeatures.js +1 -1
  40. package/package.json +2 -2
@@ -3,6 +3,11 @@ import { fireEvent, render, screen } from "@testing-library/react";
3
3
  import { MemoryRouter } from "react-router";
4
4
  import { createTestWrapper, mockOffsetSize } from "../../test/testUtils.js";
5
5
  import { BucketList } from "../buckets/BucketList.js";
6
+ import * as __WEBPACK_EXTERNAL_MODULE__contexts_DataBrowserUICustomizationContext_js_f267b01c__ from "../../contexts/DataBrowserUICustomizationContext.js";
7
+ jest.mock("../../contexts/DataBrowserUICustomizationContext");
8
+ const mockUseDataBrowserUICustomization = (config = {})=>{
9
+ jest.spyOn(__WEBPACK_EXTERNAL_MODULE__contexts_DataBrowserUICustomizationContext_js_f267b01c__, "useDataBrowserUICustomization").mockReturnValue(config);
10
+ };
6
11
  const renderBucketList = (props = {})=>{
7
12
  const Wrapper = createTestWrapper();
8
13
  return render(/*#__PURE__*/ jsx(MemoryRouter, {
@@ -32,6 +37,7 @@ describe("BucketList", ()=>{
32
37
  beforeEach(()=>{
33
38
  jest.clearAllMocks();
34
39
  mockOffsetSize(800, 600);
40
+ mockUseDataBrowserUICustomization({});
35
41
  });
36
42
  it("shows a table with proper headers", ()=>{
37
43
  renderBucketList({
@@ -63,28 +69,6 @@ describe("BucketList", ()=>{
63
69
  const dateElements = screen.getAllByText(/2024/);
64
70
  expect(dateElements.length).toBeGreaterThanOrEqual(3);
65
71
  });
66
- it("shows storage location when renderBucketLocation is provided", ()=>{
67
- const renderBucketLocation = jest.fn((bucketName)=>/*#__PURE__*/ jsxs("span", {
68
- children: [
69
- "Location for ",
70
- bucketName
71
- ]
72
- }));
73
- renderBucketList({
74
- buckets: mockBuckets,
75
- renderBucketLocation
76
- });
77
- expect(renderBucketLocation).toHaveBeenCalledWith("test-bucket-1");
78
- expect(renderBucketLocation).toHaveBeenCalledWith("test-bucket-2");
79
- expect(renderBucketLocation).toHaveBeenCalledWith("test-bucket-3");
80
- });
81
- it("shows dash for storage location when renderBucketLocation is not provided", ()=>{
82
- renderBucketList({
83
- buckets: mockBuckets
84
- });
85
- const dashes = screen.getAllByText("-");
86
- expect(dashes.length).toBeGreaterThan(0);
87
- });
88
72
  it("handles bucket selection when onBucketSelect is provided", ()=>{
89
73
  const onBucketSelect = jest.fn();
90
74
  renderBucketList({
@@ -222,47 +206,54 @@ describe("BucketList", ()=>{
222
206
  fireEvent.click(bucketName.closest('[role="row"]') || bucketName);
223
207
  expect(onBucketSelect).not.toHaveBeenCalled();
224
208
  });
225
- describe("additionalColumns support", ()=>{
226
- it("renders additional columns when additionalColumns prop is provided", ()=>{
227
- const additionalColumns = [
228
- {
229
- Header: "Metrics",
230
- accessor: "metrics",
231
- id: "metrics",
232
- Cell: ()=>/*#__PURE__*/ jsx("span", {
233
- children: "Metrics Data"
234
- })
235
- }
236
- ];
209
+ describe("extraBucketListColumns support", ()=>{
210
+ it("renders extra columns when extraBucketListColumns is configured", ()=>{
211
+ const CustomColumn = ({ data })=>/*#__PURE__*/ jsxs("span", {
212
+ children: [
213
+ "Custom data for ",
214
+ data.Name
215
+ ]
216
+ });
217
+ mockUseDataBrowserUICustomization({
218
+ extraBucketListColumns: [
219
+ {
220
+ id: "customData",
221
+ header: "Custom Data",
222
+ render: CustomColumn
223
+ }
224
+ ]
225
+ });
237
226
  renderBucketList({
238
- buckets: mockBuckets,
239
- additionalColumns
227
+ buckets: mockBuckets
228
+ });
229
+ expect(screen.getByText("Custom Data")).toBeInTheDocument();
230
+ expect(screen.getByText("Custom data for test-bucket-1")).toBeInTheDocument();
231
+ expect(screen.getByText("Custom data for test-bucket-2")).toBeInTheDocument();
232
+ expect(screen.getByText("Custom data for test-bucket-3")).toBeInTheDocument();
233
+ });
234
+ it("renders multiple extra columns in correct order", ()=>{
235
+ const ColumnA = ()=>/*#__PURE__*/ jsx("span", {
236
+ children: "A"
237
+ });
238
+ const ColumnB = ()=>/*#__PURE__*/ jsx("span", {
239
+ children: "B"
240
+ });
241
+ mockUseDataBrowserUICustomization({
242
+ extraBucketListColumns: [
243
+ {
244
+ id: "columnA",
245
+ header: "Column A",
246
+ render: ColumnA
247
+ },
248
+ {
249
+ id: "columnB",
250
+ header: "Column B",
251
+ render: ColumnB
252
+ }
253
+ ]
240
254
  });
241
- expect(screen.getByText("Metrics")).toBeInTheDocument();
242
- expect(screen.getAllByText("Metrics Data")).toHaveLength(3);
243
- });
244
- it("renders multiple additional columns in correct order", ()=>{
245
- const additionalColumns = [
246
- {
247
- Header: "Column A",
248
- accessor: "columnA",
249
- id: "columnA",
250
- Cell: ()=>/*#__PURE__*/ jsx("span", {
251
- children: "A"
252
- })
253
- },
254
- {
255
- Header: "Column B",
256
- accessor: "columnB",
257
- id: "columnB",
258
- Cell: ()=>/*#__PURE__*/ jsx("span", {
259
- children: "B"
260
- })
261
- }
262
- ];
263
255
  renderBucketList({
264
- buckets: mockBuckets,
265
- additionalColumns
256
+ buckets: mockBuckets
266
257
  });
267
258
  const headers = screen.getAllByRole("columnheader");
268
259
  const headerTexts = headers.map((h)=>h.textContent);
@@ -281,7 +272,7 @@ describe("BucketList", ()=>{
281
272
  expect(columnAIndex).toBeLessThan(columnBIndex);
282
273
  expect(columnBIndex).toBeLessThan(createdOnIndex);
283
274
  });
284
- it("works without additional columns (backward compatibility)", ()=>{
275
+ it("works without extra columns (shows default columns)", ()=>{
285
276
  renderBucketList({
286
277
  buckets: mockBuckets
287
278
  });
@@ -292,124 +283,358 @@ describe("BucketList", ()=>{
292
283
  expect(headerTexts).toContain("Created on");
293
284
  expect(headerTexts).toHaveLength(3);
294
285
  });
286
+ it("receives full bucket data in render component", ()=>{
287
+ const CustomColumn = jest.fn(({ data })=>/*#__PURE__*/ jsxs("span", {
288
+ children: [
289
+ "Bucket ",
290
+ data.Name
291
+ ]
292
+ }));
293
+ mockUseDataBrowserUICustomization({
294
+ extraBucketListColumns: [
295
+ {
296
+ id: "customColumn",
297
+ header: "Custom",
298
+ render: CustomColumn
299
+ }
300
+ ]
301
+ });
302
+ renderBucketList({
303
+ buckets: mockBuckets
304
+ });
305
+ expect(CustomColumn).toHaveBeenCalledWith(expect.objectContaining({
306
+ data: mockBuckets[0]
307
+ }), expect.anything());
308
+ });
309
+ it("supports custom column widths", ()=>{
310
+ const CustomColumn = ({ data })=>/*#__PURE__*/ jsxs("span", {
311
+ children: [
312
+ "Width: ",
313
+ data.Name
314
+ ]
315
+ });
316
+ mockUseDataBrowserUICustomization({
317
+ extraBucketListColumns: [
318
+ {
319
+ id: "customWidth",
320
+ header: "Custom Width",
321
+ width: "200px",
322
+ render: CustomColumn
323
+ }
324
+ ]
325
+ });
326
+ renderBucketList({
327
+ buckets: mockBuckets
328
+ });
329
+ expect(screen.getByText("Custom Width")).toBeInTheDocument();
330
+ expect(screen.getByText("Width: test-bucket-1")).toBeInTheDocument();
331
+ });
332
+ it("supports custom columns with IDs not in Bucket type (e.g., computed data)", ()=>{
333
+ const DataUsedColumn = ({ data })=>/*#__PURE__*/ jsxs("span", {
334
+ children: [
335
+ "Data used for ",
336
+ data.Name
337
+ ]
338
+ });
339
+ mockUseDataBrowserUICustomization({
340
+ extraBucketListColumns: [
341
+ {
342
+ id: "dataUsed",
343
+ header: "Data Used",
344
+ render: DataUsedColumn
345
+ }
346
+ ]
347
+ });
348
+ renderBucketList({
349
+ buckets: mockBuckets
350
+ });
351
+ expect(screen.getByText("Data Used")).toBeInTheDocument();
352
+ expect(screen.getByText("Data used for test-bucket-1")).toBeInTheDocument();
353
+ expect(screen.getByText("Data used for test-bucket-2")).toBeInTheDocument();
354
+ expect(screen.getByText("Data used for test-bucket-3")).toBeInTheDocument();
355
+ });
356
+ it("supports mixing native and custom column IDs", ()=>{
357
+ const RegionColumn = ({ data })=>/*#__PURE__*/ jsxs("span", {
358
+ children: [
359
+ "Region: ",
360
+ data.Name
361
+ ]
362
+ });
363
+ const MetricsColumn = ({ data })=>/*#__PURE__*/ jsxs("span", {
364
+ children: [
365
+ "Metrics for ",
366
+ data.Name
367
+ ]
368
+ });
369
+ mockUseDataBrowserUICustomization({
370
+ extraBucketListColumns: [
371
+ {
372
+ id: "location",
373
+ header: "Region",
374
+ render: RegionColumn
375
+ },
376
+ {
377
+ id: "customMetrics",
378
+ header: "Metrics",
379
+ render: MetricsColumn
380
+ }
381
+ ]
382
+ });
383
+ renderBucketList({
384
+ buckets: mockBuckets
385
+ });
386
+ expect(screen.queryByText("Storage Location")).not.toBeInTheDocument();
387
+ expect(screen.getByText("Region")).toBeInTheDocument();
388
+ expect(screen.getByText("Metrics")).toBeInTheDocument();
389
+ expect(screen.getByText("Region: test-bucket-1")).toBeInTheDocument();
390
+ expect(screen.getByText("Metrics for test-bucket-1")).toBeInTheDocument();
391
+ });
392
+ it("can replace default columns by using matching IDs", ()=>{
393
+ const CustomLocationColumn = ({ data })=>/*#__PURE__*/ jsxs("span", {
394
+ children: [
395
+ "Custom location for ",
396
+ data.Name
397
+ ]
398
+ });
399
+ mockUseDataBrowserUICustomization({
400
+ extraBucketListColumns: [
401
+ {
402
+ id: "location",
403
+ header: "Custom Location",
404
+ render: CustomLocationColumn
405
+ }
406
+ ]
407
+ });
408
+ renderBucketList({
409
+ buckets: mockBuckets
410
+ });
411
+ expect(screen.getByText("Custom Location")).toBeInTheDocument();
412
+ expect(screen.queryByText("Storage Location")).not.toBeInTheDocument();
413
+ expect(screen.getByText("Custom location for test-bucket-1")).toBeInTheDocument();
414
+ expect(screen.getByText("Custom location for test-bucket-2")).toBeInTheDocument();
415
+ expect(screen.getByText("Custom location for test-bucket-3")).toBeInTheDocument();
416
+ });
417
+ it("can replace multiple default columns simultaneously", ()=>{
418
+ const CustomLocationColumn = ({ data })=>/*#__PURE__*/ jsxs("span", {
419
+ children: [
420
+ "Loc: ",
421
+ data.Name
422
+ ]
423
+ });
424
+ const CustomDateColumn = ({ data })=>/*#__PURE__*/ jsxs("span", {
425
+ children: [
426
+ "Date: ",
427
+ data.CreationDate?.toString()
428
+ ]
429
+ });
430
+ mockUseDataBrowserUICustomization({
431
+ extraBucketListColumns: [
432
+ {
433
+ id: "location",
434
+ header: "Loc",
435
+ render: CustomLocationColumn
436
+ },
437
+ {
438
+ id: "date",
439
+ header: "Date",
440
+ render: CustomDateColumn
441
+ }
442
+ ]
443
+ });
444
+ renderBucketList({
445
+ buckets: mockBuckets
446
+ });
447
+ expect(screen.getByText("Loc")).toBeInTheDocument();
448
+ expect(screen.getByText("Date")).toBeInTheDocument();
449
+ expect(screen.queryByText("Storage Location")).not.toBeInTheDocument();
450
+ expect(screen.queryByText("Created on")).not.toBeInTheDocument();
451
+ expect(screen.getByText("Loc: test-bucket-1")).toBeInTheDocument();
452
+ });
453
+ it("maintains correct column order when replacing and adding columns", ()=>{
454
+ const CustomLocationColumn = ()=>/*#__PURE__*/ jsx("span", {
455
+ children: "Custom Loc"
456
+ });
457
+ const ExtraColumn = ()=>/*#__PURE__*/ jsx("span", {
458
+ children: "Extra"
459
+ });
460
+ mockUseDataBrowserUICustomization({
461
+ extraBucketListColumns: [
462
+ {
463
+ id: "location",
464
+ header: "Custom Location",
465
+ render: CustomLocationColumn
466
+ },
467
+ {
468
+ id: "extraData",
469
+ header: "Extra Data",
470
+ render: ExtraColumn
471
+ }
472
+ ]
473
+ });
474
+ renderBucketList({
475
+ buckets: mockBuckets
476
+ });
477
+ const headers = screen.getAllByRole("columnheader");
478
+ const headerTexts = headers.map((h)=>h.textContent);
479
+ const bucketNameIndex = headerTexts.indexOf("Bucket Name");
480
+ const customLocationIndex = headerTexts.indexOf("Custom Location");
481
+ const extraDataIndex = headerTexts.indexOf("Extra Data");
482
+ const createdOnIndex = headerTexts.indexOf("Created on");
483
+ expect(bucketNameIndex).toBe(0);
484
+ expect(customLocationIndex).toBe(1);
485
+ expect(extraDataIndex).toBe(2);
486
+ expect(createdOnIndex).toBe(3);
487
+ });
295
488
  });
296
- describe("transformBucketData support", ()=>{
297
- it("transforms bucket data when transformBucketData is provided", ()=>{
298
- const transformBucketData = jest.fn((bucket)=>({
299
- ...bucket,
300
- metrics: {
301
- value: 100
489
+ describe("extraBucketListActions support", ()=>{
490
+ it("renders extra actions when extraBucketListActions is configured", ()=>{
491
+ const CustomAction = ()=>/*#__PURE__*/ jsx("button", {
492
+ children: "Custom Action"
493
+ });
494
+ mockUseDataBrowserUICustomization({
495
+ extraBucketListActions: [
496
+ {
497
+ id: "customAction",
498
+ render: CustomAction
302
499
  }
303
- }));
304
- const additionalColumns = [
305
- {
306
- Header: "Metrics",
307
- accessor: "metrics",
308
- id: "metrics",
309
- Cell: ({ value })=>/*#__PURE__*/ jsxs("span", {
310
- children: [
311
- "Value: ",
312
- value.value
313
- ]
314
- })
315
- }
316
- ];
500
+ ]
501
+ });
317
502
  renderBucketList({
318
- buckets: mockBuckets,
319
- additionalColumns,
320
- transformBucketData
321
- });
322
- expect(transformBucketData).toHaveBeenCalledTimes(3);
323
- expect(transformBucketData).toHaveBeenCalledWith(mockBuckets[0]);
324
- expect(transformBucketData).toHaveBeenCalledWith(mockBuckets[1]);
325
- expect(transformBucketData).toHaveBeenCalledWith(mockBuckets[2]);
326
- });
327
- it("renders transformed data in additional columns", ()=>{
328
- const transformBucketData = (bucket)=>({
329
- ...bucket,
330
- metrics: {
331
- value: "test-bucket-1" === bucket.Name ? 50 : 100
503
+ buckets: mockBuckets
504
+ });
505
+ expect(screen.getByText("Custom Action")).toBeInTheDocument();
506
+ });
507
+ it("renders multiple extra actions", ()=>{
508
+ const Action1 = ()=>/*#__PURE__*/ jsx("button", {
509
+ children: "Action 1"
510
+ });
511
+ const Action2 = ()=>/*#__PURE__*/ jsx("button", {
512
+ children: "Action 2"
513
+ });
514
+ mockUseDataBrowserUICustomization({
515
+ extraBucketListActions: [
516
+ {
517
+ id: "action1",
518
+ render: Action1
519
+ },
520
+ {
521
+ id: "action2",
522
+ render: Action2
332
523
  }
524
+ ]
525
+ });
526
+ renderBucketList({
527
+ buckets: mockBuckets
528
+ });
529
+ expect(screen.getByText("Action 1")).toBeInTheDocument();
530
+ expect(screen.getByText("Action 2")).toBeInTheDocument();
531
+ });
532
+ it("renders actions alongside default Create Bucket button", ()=>{
533
+ const CustomAction = ()=>/*#__PURE__*/ jsx("button", {
534
+ children: "Export"
333
535
  });
334
- const additionalColumns = [
335
- {
336
- Header: "Metrics",
337
- accessor: "metrics",
338
- id: "metrics",
339
- Cell: ({ value })=>/*#__PURE__*/ jsxs("span", {
340
- children: [
341
- "Metric: ",
342
- value.value
343
- ]
344
- })
345
- }
346
- ];
536
+ mockUseDataBrowserUICustomization({
537
+ extraBucketListActions: [
538
+ {
539
+ id: "export",
540
+ render: CustomAction
541
+ }
542
+ ]
543
+ });
347
544
  renderBucketList({
348
545
  buckets: mockBuckets,
349
- additionalColumns,
350
- transformBucketData
351
- });
352
- expect(screen.getByText("Metric: 50")).toBeInTheDocument();
353
- expect(screen.getAllByText("Metric: 100")).toHaveLength(2);
354
- });
355
- it("works without transformBucketData (uses default behavior)", ()=>{
356
- const additionalColumns = [
357
- {
358
- Header: "Test Column",
359
- accessor: "Name",
360
- id: "testColumn",
361
- Cell: ({ value })=>/*#__PURE__*/ jsxs("span", {
362
- children: [
363
- "Name: ",
364
- value
365
- ]
366
- })
367
- }
368
- ];
546
+ onCreateBucket: jest.fn()
547
+ });
548
+ expect(screen.getByText("Create Bucket")).toBeInTheDocument();
549
+ expect(screen.getByText("Export")).toBeInTheDocument();
550
+ });
551
+ it("works without extra actions", ()=>{
369
552
  renderBucketList({
370
553
  buckets: mockBuckets,
371
- additionalColumns
554
+ onCreateBucket: jest.fn()
372
555
  });
373
- expect(screen.getByText("Name: test-bucket-1")).toBeInTheDocument();
374
- expect(screen.getByText("Name: test-bucket-2")).toBeInTheDocument();
375
- expect(screen.getByText("Name: test-bucket-3")).toBeInTheDocument();
556
+ expect(screen.getByText("Create Bucket")).toBeInTheDocument();
376
557
  });
377
- });
378
- describe("generic type support", ()=>{
379
- it("maintains type safety with extended bucket types", ()=>{
380
- const transformBucketData = (bucket)=>({
381
- ...bucket,
382
- customField: `Custom ${bucket.Name}`,
383
- numericField: 42
558
+ it("can replace default Create Bucket action by using 'createBucket' ID", ()=>{
559
+ const CustomCreateAction = ()=>/*#__PURE__*/ jsx("button", {
560
+ children: "Custom Create"
384
561
  });
385
- const additionalColumns = [
386
- {
387
- Header: "Custom",
388
- accessor: "customField",
389
- id: "custom",
390
- Cell: ({ value })=>/*#__PURE__*/ jsx("span", {
391
- children: value
392
- })
393
- },
394
- {
395
- Header: "Number",
396
- accessor: "numericField",
397
- id: "numeric",
398
- Cell: ({ value })=>/*#__PURE__*/ jsxs("span", {
399
- children: [
400
- "Num: ",
401
- value
402
- ]
403
- })
404
- }
405
- ];
562
+ mockUseDataBrowserUICustomization({
563
+ extraBucketListActions: [
564
+ {
565
+ id: "createBucket",
566
+ render: CustomCreateAction
567
+ }
568
+ ]
569
+ });
570
+ renderBucketList({
571
+ buckets: mockBuckets,
572
+ onCreateBucket: jest.fn()
573
+ });
574
+ expect(screen.getByText("Custom Create")).toBeInTheDocument();
575
+ expect(screen.queryByText("Create Bucket")).not.toBeInTheDocument();
576
+ });
577
+ it("can mix replacing default action and adding new actions", ()=>{
578
+ const CustomCreateAction = ()=>/*#__PURE__*/ jsx("button", {
579
+ children: "Custom Create"
580
+ });
581
+ const ExportAction = ()=>/*#__PURE__*/ jsx("button", {
582
+ children: "Export"
583
+ });
584
+ mockUseDataBrowserUICustomization({
585
+ extraBucketListActions: [
586
+ {
587
+ id: "createBucket",
588
+ render: CustomCreateAction
589
+ },
590
+ {
591
+ id: "export",
592
+ render: ExportAction
593
+ }
594
+ ]
595
+ });
596
+ renderBucketList({
597
+ buckets: mockBuckets,
598
+ onCreateBucket: jest.fn()
599
+ });
600
+ expect(screen.getByText("Custom Create")).toBeInTheDocument();
601
+ expect(screen.getByText("Export")).toBeInTheDocument();
602
+ expect(screen.queryByText("Create Bucket")).not.toBeInTheDocument();
603
+ });
604
+ it("maintains correct action order when replacing and adding actions", ()=>{
605
+ const CustomCreateAction = ()=>/*#__PURE__*/ jsx("button", {
606
+ children: "Custom Create"
607
+ });
608
+ const Action1 = ()=>/*#__PURE__*/ jsx("button", {
609
+ children: "Action 1"
610
+ });
611
+ const Action2 = ()=>/*#__PURE__*/ jsx("button", {
612
+ children: "Action 2"
613
+ });
614
+ mockUseDataBrowserUICustomization({
615
+ extraBucketListActions: [
616
+ {
617
+ id: "createBucket",
618
+ render: CustomCreateAction
619
+ },
620
+ {
621
+ id: "action1",
622
+ render: Action1
623
+ },
624
+ {
625
+ id: "action2",
626
+ render: Action2
627
+ }
628
+ ]
629
+ });
406
630
  renderBucketList({
407
631
  buckets: mockBuckets,
408
- additionalColumns,
409
- transformBucketData
632
+ onCreateBucket: jest.fn()
410
633
  });
411
- expect(screen.getByText("Custom test-bucket-1")).toBeInTheDocument();
412
- expect(screen.getAllByText("Num: 42")).toHaveLength(3);
634
+ const buttons = screen.getAllByRole("button");
635
+ expect(buttons[0]).toHaveTextContent("Custom Create");
636
+ expect(buttons[1]).toHaveTextContent("Action 1");
637
+ expect(buttons[2]).toHaveTextContent("Action 2");
413
638
  });
414
639
  });
415
640
  });