@thepalaceproject/circulation-admin 1.22.0-post.5 → 1.22.0-post.8

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/package.json CHANGED
@@ -60,7 +60,7 @@
60
60
  "react-dom": "^16.8.6",
61
61
  "react-redux": "^7.2.9",
62
62
  "react-router": "^3.2.0",
63
- "recharts": "^1.8.6",
63
+ "recharts": "^2.12.7",
64
64
  "redux": "^4.2.1",
65
65
  "redux-thunk": "^2.4.2",
66
66
  "request": "^2.85.0",
@@ -119,6 +119,7 @@
119
119
  "react-axe": "^3.3.0",
120
120
  "react-test-renderer": "^16.14.0",
121
121
  "redux-mock-store": "^1.5.4",
122
+ "resize-observer-polyfill": "^1.5.1",
122
123
  "sass": "^1.64.2",
123
124
  "sass-lint": "^1.13.1",
124
125
  "sass-loader": "^13.2.0",
@@ -149,5 +150,5 @@
149
150
  "*.{js,jsx,ts,tsx,css,md}": "prettier --write",
150
151
  "*.{js,css,md}": "prettier --write"
151
152
  },
152
- "version": "1.22.0-post.5"
153
+ "version": "1.22.0-post.8"
153
154
  }
@@ -1,8 +1,6 @@
1
1
  import * as React from "react";
2
2
  import { render } from "@testing-library/react";
3
- import LibraryStats, {
4
- ALL_LIBRARIES_HEADING,
5
- } from "../../../src/components/LibraryStats";
3
+ import { ALL_LIBRARIES_HEADING } from "../../../src/components/LibraryStats";
6
4
  import { CustomTooltip } from "../../../src/components/StatsCollectionsBarChart";
7
5
  import {
8
6
  componentWithProviders,
@@ -28,6 +26,8 @@ import { api } from "../../../src/features/api/apiSlice";
28
26
 
29
27
  const normalizedData = normalizeStatistics(statisticsApiResponseData);
30
28
 
29
+ global.ResizeObserver = require("resize-observer-polyfill");
30
+
31
31
  describe("Dashboard Statistics", () => {
32
32
  // NB: This adds test to the already existing tests in:
33
33
  // - `src/components/__tests__/LibraryStats-test.tsx`.
@@ -274,7 +274,7 @@ describe("Dashboard Statistics", () => {
274
274
  });
275
275
  });
276
276
 
277
- it("shows the right groups without a library", () => {
277
+ it("shows the right groups with/out a library", () => {
278
278
  const { getAllByRole } = renderWithProviders(<Stats />);
279
279
 
280
280
  const groupHeadings = getAllByRole("heading", { level: 3 });
@@ -290,282 +290,368 @@ describe("Dashboard Statistics", () => {
290
290
  });
291
291
  });
292
292
  });
293
- });
294
293
 
295
- describe("requesting inventory reports", () => {
296
- // Convert from the API format to our in-app format.
297
- const statisticsData = normalizeStatistics(statisticsApiResponseData);
298
- const librariesStatsTestDataByKey = statisticsData.libraries.reduce(
299
- (map, library) => ({ ...map, [library.key]: library }),
300
- {}
301
- );
302
- const sampleStatsData = librariesStatsTestDataByKey[sampleLibraryKey];
303
-
304
- const systemAdmin = [{ role: "system" }];
305
- const managerAll = [{ role: "manager-all" }];
306
- const librarianAll = [{ role: "librarian-all" }];
307
-
308
- const fakeQuickSightHref = "https://example.com/fakeQS";
309
- const baseContextProviderProps = {
310
- csrfToken: "",
311
- featureFlags: { reportsOnlyForSysadmins: false },
312
- quicksightPagePath: fakeQuickSightHref,
313
- };
314
-
315
- const renderFor = (
316
- onlySysadmins: boolean,
317
- roles: { role: string; library?: string }[]
318
- ) => {
319
- const contextProviderProps: ContextProviderProps = {
320
- ...baseContextProviderProps,
321
- featureFlags: { reportsOnlyForSysadmins: onlySysadmins },
322
- roles,
323
- };
294
+ describe("shows the correct UI with/out sysadmin role", () => {
295
+ const systemAdmin = [{ role: "system" }];
296
+ const managerAll = [{ role: "manager-all" }];
297
+ const librarianAll = [{ role: "librarian-all" }];
298
+
299
+ const collectionNames = [
300
+ "New BiblioBoard Test",
301
+ "New Bibliotheca Test Collection",
302
+ "Palace Bookshelf",
303
+ "TEST Baker & Taylor",
304
+ "TEST Palace Marketplace",
305
+ ];
324
306
 
325
- const {
326
- container,
327
- getByRole,
328
- queryByRole,
329
- } = renderWithProviders(
330
- <LibraryStats stats={sampleStatsData} library={sampleLibraryKey} />,
331
- { contextProviderProps }
332
- );
307
+ it("tests BarChart component", () => {
308
+ const contextProviderProps: Partial<ContextProviderProps> = {
309
+ roles: systemAdmin,
310
+ dashboardCollectionsBarChart: { width: 800 },
311
+ };
312
+ const { container, getByRole } = renderWithProviders(
313
+ <Stats library={sampleLibraryKey} />,
314
+ { contextProviderProps }
315
+ );
333
316
 
334
- // We should always render a Usage reports group when a library is specified.
335
- getByRole("heading", { level: 3, name: statGroupToHeading.usageReports });
336
- const usageReportLink = getByRole("link", { name: /View Usage/i });
337
- expect(usageReportLink).toHaveAttribute("href", fakeQuickSightHref);
338
-
339
- const result = queryByRole("button", { name: /Request Report/i });
340
- // Clean up the container after each render.
341
- document.body.removeChild(container);
342
- return result;
343
- };
344
-
345
- it("shows inventory reports only for sysadmins, if feature flag set", async () => {
346
- // If the feature flag is set, the button should be visible only to sysadmins.
347
- expect(renderFor(true, systemAdmin)).not.toBeNull();
348
- expect(renderFor(true, managerAll)).toBeNull();
349
- expect(renderFor(true, librarianAll)).toBeNull();
350
- // If the feature flag is false, the button should be visible to all users.
351
- expect(renderFor(false, systemAdmin)).not.toBeNull();
352
- expect(renderFor(false, managerAll)).not.toBeNull();
353
- expect(renderFor(false, librarianAll)).not.toBeNull();
354
- });
355
- });
317
+ const collectionsHeading = getByRole("heading", {
318
+ level: 3,
319
+ name: statGroupToHeading.collections,
320
+ });
321
+ const collectionsGroup = collectionsHeading.closest(".stat-group");
322
+ const barChartAxisTick = collectionsGroup.querySelectorAll(
323
+ ".recharts-cartesian-axis-tick"
324
+ );
356
325
 
357
- describe("charting - custom tooltip", () => {
358
- const defaultLabel = "Collection X";
359
- const summaryInventory = {
360
- availableTitles: 7953,
361
- licensedTitles: 7974,
362
- meteredLicenseTitles: 7974,
363
- meteredLicensesAvailable: 75446,
364
- meteredLicensesOwned: 301541,
365
- openAccessTitles: 0,
366
- titles: 7974,
367
- unlimitedLicenseTitles: 0,
368
- };
369
- const perMediumInventory = {
370
- Audio: {
371
- availableTitles: 148,
372
- licensedTitles: 165,
373
- meteredLicenseTitles: 165,
374
- meteredLicensesAvailable: 221,
375
- meteredLicensesOwned: 392,
376
- openAccessTitles: 0,
377
- titles: 165,
378
- unlimitedLicenseTitles: 0,
379
- },
380
- Book: {
381
- availableTitles: 7805,
382
- licensedTitles: 7809,
383
- meteredLicenseTitles: 7809,
384
- meteredLicensesAvailable: 75225,
385
- meteredLicensesOwned: 301149,
386
- openAccessTitles: 0,
387
- titles: 7809,
388
- unlimitedLicenseTitles: 0,
389
- },
390
- };
391
- const defaultChartItemWithoutPerMediumInventory = {
392
- name: defaultLabel,
393
- ...summaryInventory,
394
- };
395
- const defaultChartItemWithPerMediumInventory = {
396
- ...defaultChartItemWithoutPerMediumInventory,
397
- _by_medium: perMediumInventory,
398
- };
399
- const defaultPayload = [
400
- {
401
- fill: "#606060",
402
- dataKey: "meteredLicenseTitles",
403
- name: "Metered License Titles",
404
- color: "#606060",
405
- value: 7974,
406
- },
407
- {
408
- fill: "#404040",
409
- dataKey: "unlimitedLicenseTitles",
410
- name: "Unlimited License Titles",
411
- color: "#404040",
412
- value: 0,
413
- },
414
- {
415
- fill: "#202020",
416
- dataKey: "openAccessTitles",
417
- name: "Open Access Titles",
418
- color: "#202020",
419
- value: 0,
420
- },
421
- ];
422
-
423
- const populateTooltipProps = ({
424
- active = true,
425
- label = defaultLabel,
426
- payload = [],
427
- chartItem = undefined,
428
- }) => {
429
- const constructedChartItem = !chartItem
430
- ? chartItem
431
- : {
432
- ...chartItem,
433
- name: label,
434
- };
435
- const constructedPayload = payload.map((entry) => ({
436
- ...entry,
437
- payload: constructedChartItem,
438
- }));
439
- return {
440
- active,
441
- label,
442
- payload: constructedPayload,
443
- };
444
- };
445
-
446
- /**
447
- * Helper function to test passing tests for a tooltip
448
- *
449
- * @param tooltipProps - passed to the <CustomTooltip /> component
450
- * @param expectedInventoryItemText - the expected inventory item text content
451
- */
452
- const expectPassingTestsForActiveTooltip = ({
453
- tooltipProps,
454
- expectedInventoryItemText,
455
- }) => {
456
- const { container, getByRole } = render(
457
- <CustomTooltip {...tooltipProps} />
458
- );
459
- const tooltipContent = container.querySelector(".customTooltip");
460
-
461
- const detail = tooltipContent.querySelector(".customTooltipDetail");
462
- const detailChildren = detail.children;
463
- const heading = getByRole("heading", { level: 1, name: "Collection X" });
464
- const items = tooltipContent.querySelectorAll("p.customTooltipItem");
465
- const divider = detail.querySelector("hr");
466
-
467
- expect(heading).toHaveTextContent("Collection X");
468
-
469
- // Eight (8) metrics in the following order.
470
- expect(items).toHaveLength(8);
471
- // The expected inventory item labels array should be the same length.
472
- expect(expectedInventoryItemText).toHaveLength(items.length);
473
- // And the items should contain at least the expected text.
474
- Array.from(items).forEach((item, index) => {
475
- expect(item).toHaveTextContent(expectedInventoryItemText[index]);
476
- });
326
+ // We expect the first ticks to be along the y-axis, which
327
+ // should have our collection names.
328
+ collectionNames.forEach((name, index) => {
329
+ expect(barChartAxisTick[index]).toHaveTextContent(name);
330
+ });
477
331
 
478
- // The heading should be at the top and the divider (`hr`)
479
- // should be between the third and fourth statistics.
480
- expect(detailChildren).toHaveLength(10);
481
- expect(heading).toEqual(detailChildren[0]);
482
- expect(items[0]).toEqual(detailChildren[1]);
483
- expect(items[2]).toEqual(detailChildren[3]);
484
- expect(divider).toEqual(detailChildren[4]);
485
- expect(items[3]).toEqual(detailChildren[5]);
486
- expect(items[7]).toEqual(detailChildren[9]);
487
- };
488
-
489
- it("should not render when active is false", () => {
490
- // Recharts sticks some extra props
491
- const tooltipProps = populateTooltipProps({
492
- active: false,
493
- chartItem: defaultChartItemWithPerMediumInventory,
494
- payload: defaultPayload,
332
+ // Clean up the container after each render.
333
+ document.body.removeChild(container);
495
334
  });
496
335
 
497
- const { container } = render(<CustomTooltip {...tooltipProps} />);
498
- const tooltipContent = container.querySelectorAll(".customTooltip");
336
+ it("shows collection bar chart for sysadmins, but list for others", () => {
337
+ // We'll use this function to test multiple scenarios.
338
+ const testFor = (
339
+ expectBarChart: boolean,
340
+ roles: { role: string; library?: string }[]
341
+ ) => {
342
+ const contextProviderProps: Partial<ContextProviderProps> = { roles };
343
+ const { container, getByRole } = renderWithProviders(
344
+ <Stats library={sampleLibraryKey} />,
345
+ { contextProviderProps }
346
+ );
347
+
348
+ const collectionsHeading = getByRole("heading", {
349
+ level: 3,
350
+ name: statGroupToHeading.collections,
351
+ });
352
+ const collectionsGroup = collectionsHeading.closest(".stat-group");
353
+
354
+ if (expectBarChart) {
355
+ collectionsGroup.querySelector(".recharts-responsive-container");
356
+ } else {
357
+ const list = collectionsGroup.querySelector("ul");
358
+ const items = list.querySelectorAll("li");
359
+ expect(items.length).toBe(collectionNames.length);
360
+
361
+ collectionNames.forEach((name: string) => {
362
+ expect(list).toHaveTextContent(name);
363
+ });
364
+ items.forEach((item, index) => {
365
+ expect(item).toHaveTextContent(collectionNames[index]);
366
+ });
367
+ }
368
+
369
+ // Clean up the container after each render.
370
+ document.body.removeChild(container);
371
+ };
372
+
373
+ // If the feature flag is set, the button should be visible only to sysadmins.
374
+ testFor(true, systemAdmin);
375
+ testFor(false, managerAll);
376
+ testFor(false, librarianAll);
377
+ });
499
378
 
500
- expect(tooltipContent).toHaveLength(0);
501
- });
502
- it("should render when active is true", () => {
503
- const tooltipProps = populateTooltipProps({
504
- active: true,
505
- chartItem: defaultChartItemWithoutPerMediumInventory,
506
- payload: defaultPayload,
379
+ it("shows inventory reports only for sysadmins, if sysadmin-only flag set", () => {
380
+ const fakeQuickSightHref = "https://example.com/fakeQS";
381
+
382
+ // We'll use this function to test multiple scenarios.
383
+ const renderFor = (
384
+ onlySysadmins: boolean,
385
+ roles: { role: string; library?: string }[]
386
+ ) => {
387
+ const contextProviderProps: Partial<ContextProviderProps> = {
388
+ featureFlags: { reportsOnlyForSysadmins: onlySysadmins },
389
+ roles,
390
+ quicksightPagePath: fakeQuickSightHref,
391
+ };
392
+ const {
393
+ container,
394
+ getByRole,
395
+ queryByRole,
396
+ queryByText,
397
+ } = renderWithProviders(<Stats library={sampleLibraryKey} />, {
398
+ contextProviderProps,
399
+ });
400
+
401
+ // We should always render a Usage reports group when a library is specified.
402
+ getByRole("heading", {
403
+ level: 3,
404
+ name: statGroupToHeading.usageReports,
405
+ });
406
+ const usageReportLink = getByRole("link", { name: /View Usage/i });
407
+ expect(usageReportLink).toHaveAttribute("href", fakeQuickSightHref);
408
+
409
+ const requestButton = queryByRole("button", {
410
+ name: /Request Report/i,
411
+ });
412
+ const blurb = queryByText(
413
+ /These reports provide up-to-date data on both inventory and holds/i
414
+ );
415
+
416
+ // The inventory report blurb should be visible only when the button is.
417
+ if (requestButton) {
418
+ expect(blurb).not.toBeNull();
419
+ } else {
420
+ expect(blurb).toBeNull();
421
+ }
422
+
423
+ // Clean up the container after each render.
424
+ document.body.removeChild(container);
425
+ return requestButton;
426
+ };
427
+
428
+ // If the feature flag is set, the button should be visible only to sysadmins.
429
+ expect(renderFor(true, systemAdmin)).not.toBeNull();
430
+ expect(renderFor(true, managerAll)).toBeNull();
431
+ expect(renderFor(true, librarianAll)).toBeNull();
432
+ // If the feature flag is false, the button should be visible to all users.
433
+ expect(renderFor(false, systemAdmin)).not.toBeNull();
434
+ expect(renderFor(false, managerAll)).not.toBeNull();
435
+ expect(renderFor(false, librarianAll)).not.toBeNull();
507
436
  });
437
+ });
508
438
 
509
- const expectedInventoryItemText = [
510
- "Titles:",
511
- "Available Titles:",
512
- "Metered License Titles:",
513
- "Licensed Titles:",
514
- "Metered Licenses Available:",
515
- "Metered Licenses Owned:",
516
- "Open Access Titles:",
517
- "Unlimited License Titles:",
439
+ describe("charting - custom tooltip", () => {
440
+ const defaultLabel = "Collection X";
441
+ const summaryInventory = {
442
+ availableTitles: 7953,
443
+ licensedTitles: 7974,
444
+ meteredLicenseTitles: 7974,
445
+ meteredLicensesAvailable: 75446,
446
+ meteredLicensesOwned: 301541,
447
+ openAccessTitles: 0,
448
+ titles: 7974,
449
+ unlimitedLicenseTitles: 0,
450
+ };
451
+ const perMediumInventory = {
452
+ Audio: {
453
+ availableTitles: 148,
454
+ licensedTitles: 165,
455
+ meteredLicenseTitles: 165,
456
+ meteredLicensesAvailable: 221,
457
+ meteredLicensesOwned: 392,
458
+ openAccessTitles: 0,
459
+ titles: 165,
460
+ unlimitedLicenseTitles: 0,
461
+ },
462
+ Book: {
463
+ availableTitles: 7805,
464
+ licensedTitles: 7809,
465
+ meteredLicenseTitles: 7809,
466
+ meteredLicensesAvailable: 75225,
467
+ meteredLicensesOwned: 301149,
468
+ openAccessTitles: 0,
469
+ titles: 7809,
470
+ unlimitedLicenseTitles: 0,
471
+ },
472
+ };
473
+ const defaultChartItemWithoutPerMediumInventory = {
474
+ name: defaultLabel,
475
+ ...summaryInventory,
476
+ };
477
+ const defaultChartItemWithPerMediumInventory = {
478
+ ...defaultChartItemWithoutPerMediumInventory,
479
+ _by_medium: perMediumInventory,
480
+ };
481
+ const defaultPayload = [
482
+ {
483
+ fill: "#606060",
484
+ dataKey: "meteredLicenseTitles",
485
+ name: "Metered License Titles",
486
+ color: "#606060",
487
+ value: 7974,
488
+ },
489
+ {
490
+ fill: "#404040",
491
+ dataKey: "unlimitedLicenseTitles",
492
+ name: "Unlimited License Titles",
493
+ color: "#404040",
494
+ value: 0,
495
+ },
496
+ {
497
+ fill: "#202020",
498
+ dataKey: "openAccessTitles",
499
+ name: "Open Access Titles",
500
+ color: "#202020",
501
+ value: 0,
502
+ },
518
503
  ];
519
504
 
520
- expectPassingTestsForActiveTooltip({
505
+ const populateTooltipProps = ({
506
+ active = true,
507
+ label = defaultLabel,
508
+ payload = [],
509
+ chartItem = undefined,
510
+ }) => {
511
+ const constructedChartItem = !chartItem
512
+ ? chartItem
513
+ : {
514
+ ...chartItem,
515
+ name: label,
516
+ };
517
+ const constructedPayload = payload.map((entry) => ({
518
+ ...entry,
519
+ payload: constructedChartItem,
520
+ }));
521
+ return {
522
+ active,
523
+ label,
524
+ payload: constructedPayload,
525
+ };
526
+ };
527
+
528
+ /**
529
+ * Helper function to test passing tests for a tooltip
530
+ *
531
+ * @param tooltipProps - passed to the <CustomTooltip /> component
532
+ * @param expectedInventoryItemText - the expected inventory item text content
533
+ */
534
+ const expectPassingTestsForActiveTooltip = ({
521
535
  tooltipProps,
522
536
  expectedInventoryItemText,
537
+ }) => {
538
+ const { container, getByRole } = render(
539
+ <CustomTooltip {...tooltipProps} />
540
+ );
541
+ const tooltipContent = container.querySelector(".customTooltip");
542
+
543
+ const detail = tooltipContent.querySelector(".customTooltipDetail");
544
+ const detailChildren = detail.children;
545
+ const heading = getByRole("heading", {
546
+ level: 1,
547
+ name: "Collection X",
548
+ });
549
+ const items = tooltipContent.querySelectorAll("p.customTooltipItem");
550
+ const divider = detail.querySelector("hr");
551
+
552
+ expect(heading).toHaveTextContent("Collection X");
553
+
554
+ // Eight (8) metrics in the following order.
555
+ expect(items).toHaveLength(8);
556
+ // The expected inventory item labels array should be the same length.
557
+ expect(expectedInventoryItemText).toHaveLength(items.length);
558
+ // And the items should contain at least the expected text.
559
+ Array.from(items).forEach((item, index) => {
560
+ expect(item).toHaveTextContent(expectedInventoryItemText[index]);
561
+ });
562
+
563
+ // The heading should be at the top and the divider (`hr`)
564
+ // should be between the third and fourth statistics.
565
+ expect(detailChildren).toHaveLength(10);
566
+ expect(heading).toEqual(detailChildren[0]);
567
+ expect(items[0]).toEqual(detailChildren[1]);
568
+ expect(items[2]).toEqual(detailChildren[3]);
569
+ expect(divider).toEqual(detailChildren[4]);
570
+ expect(items[3]).toEqual(detailChildren[5]);
571
+ expect(items[7]).toEqual(detailChildren[9]);
572
+ };
573
+
574
+ it("should not render when active is false", () => {
575
+ // Recharts sticks some extra props
576
+ const tooltipProps = populateTooltipProps({
577
+ active: false,
578
+ chartItem: defaultChartItemWithPerMediumInventory,
579
+ payload: defaultPayload,
580
+ });
581
+
582
+ const { container } = render(<CustomTooltip {...tooltipProps} />);
583
+ const tooltipContent = container.querySelectorAll(".customTooltip");
584
+
585
+ expect(tooltipContent).toHaveLength(0);
523
586
  });
524
- });
525
- it("should render without per-medium inventory", () => {
526
- const tooltipProps = populateTooltipProps({
527
- active: true,
528
- chartItem: defaultChartItemWithoutPerMediumInventory,
529
- payload: defaultPayload,
530
- });
587
+ it("should render when active is true", () => {
588
+ const tooltipProps = populateTooltipProps({
589
+ active: true,
590
+ chartItem: defaultChartItemWithoutPerMediumInventory,
591
+ payload: defaultPayload,
592
+ });
531
593
 
532
- const expectedInventoryItemText = [
533
- "Titles: 7,974",
534
- "Available Titles: 7,953",
535
- "Metered License Titles: 7,974",
536
- "Licensed Titles: 7,974",
537
- "Metered Licenses Available: 75,446",
538
- "Metered Licenses Owned: 301,541",
539
- "Open Access Titles: 0",
540
- "Unlimited License Titles: 0",
541
- ];
594
+ const expectedInventoryItemText = [
595
+ "Titles:",
596
+ "Available Titles:",
597
+ "Metered License Titles:",
598
+ "Licensed Titles:",
599
+ "Metered Licenses Available:",
600
+ "Metered Licenses Owned:",
601
+ "Open Access Titles:",
602
+ "Unlimited License Titles:",
603
+ ];
542
604
 
543
- expectPassingTestsForActiveTooltip({
544
- tooltipProps,
545
- expectedInventoryItemText,
605
+ expectPassingTestsForActiveTooltip({
606
+ tooltipProps,
607
+ expectedInventoryItemText,
608
+ });
546
609
  });
547
- });
548
- it("should render additional detail with per-medium inventory", () => {
549
- const tooltipProps = populateTooltipProps({
550
- active: true,
551
- chartItem: defaultChartItemWithPerMediumInventory,
552
- payload: defaultPayload,
610
+ it("should render without per-medium inventory", () => {
611
+ const tooltipProps = populateTooltipProps({
612
+ active: true,
613
+ chartItem: defaultChartItemWithoutPerMediumInventory,
614
+ payload: defaultPayload,
615
+ });
616
+
617
+ const expectedInventoryItemText = [
618
+ "Titles: 7,974",
619
+ "Available Titles: 7,953",
620
+ "Metered License Titles: 7,974",
621
+ "Licensed Titles: 7,974",
622
+ "Metered Licenses Available: 75,446",
623
+ "Metered Licenses Owned: 301,541",
624
+ "Open Access Titles: 0",
625
+ "Unlimited License Titles: 0",
626
+ ];
627
+
628
+ expectPassingTestsForActiveTooltip({
629
+ tooltipProps,
630
+ expectedInventoryItemText,
631
+ });
553
632
  });
633
+ it("should render additional detail with per-medium inventory", () => {
634
+ const tooltipProps = populateTooltipProps({
635
+ active: true,
636
+ chartItem: defaultChartItemWithPerMediumInventory,
637
+ payload: defaultPayload,
638
+ });
554
639
 
555
- const expectedInventoryItemText = [
556
- "Titles: 7,974 (Audio: 165, Book: 7,809)",
557
- "Available Titles: 7,953 (Audio: 148, Book: 7,805)",
558
- "Metered License Titles: 7,974 (Audio: 165, Book: 7,809)",
559
- "Licensed Titles: 7,974 (Audio: 165, Book: 7,809)",
560
- "Metered Licenses Available: 75,446 (Audio: 221, Book: 75,225)",
561
- "Metered Licenses Owned: 301,541 (Audio: 392, Book: 301,149)",
562
- "Open Access Titles: 0",
563
- "Unlimited License Titles: 0",
564
- ];
640
+ const expectedInventoryItemText = [
641
+ "Titles: 7,974 (Audio: 165, Book: 7,809)",
642
+ "Available Titles: 7,953 (Audio: 148, Book: 7,805)",
643
+ "Metered License Titles: 7,974 (Audio: 165, Book: 7,809)",
644
+ "Licensed Titles: 7,974 (Audio: 165, Book: 7,809)",
645
+ "Metered Licenses Available: 75,446 (Audio: 221, Book: 75,225)",
646
+ "Metered Licenses Owned: 301,541 (Audio: 392, Book: 301,149)",
647
+ "Open Access Titles: 0",
648
+ "Unlimited License Titles: 0",
649
+ ];
565
650
 
566
- expectPassingTestsForActiveTooltip({
567
- tooltipProps,
568
- expectedInventoryItemText,
651
+ expectPassingTestsForActiveTooltip({
652
+ tooltipProps,
653
+ expectedInventoryItemText,
654
+ });
569
655
  });
570
656
  });
571
657
  });