@thepalaceproject/circulation-admin 1.42.2 → 1.43.0-post.10

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 (78) hide show
  1. package/.node-version +1 -1
  2. package/.nvmrc +1 -1
  3. package/CLAUDE.md +17 -8
  4. package/README.md +7 -7
  5. package/dist/circulation-admin.js +1 -1
  6. package/eslint.config.mjs +9 -1
  7. package/jest.config.js +56 -9
  8. package/package.json +10 -20
  9. package/tests/jest/actions.test.ts +962 -0
  10. package/tests/jest/components/AccountPage.test.tsx +41 -0
  11. package/tests/jest/components/AdvancedSearchBooleanFilter.test.tsx +231 -0
  12. package/tests/jest/components/AdvancedSearchFilter.test.tsx +142 -0
  13. package/tests/jest/components/AdvancedSearchFilterInput.test.tsx +212 -0
  14. package/tests/jest/components/AdvancedSearchFilterViewer.test.tsx +52 -0
  15. package/tests/jest/components/AdvancedSearchValueFilter.test.tsx +123 -0
  16. package/tests/jest/components/BookDetails.test.tsx +133 -0
  17. package/tests/jest/components/BookDetailsContainer.test.tsx +116 -0
  18. package/tests/jest/components/CatalogServices.test.tsx +63 -0
  19. package/tests/jest/components/CirculationEventsDownloadForm.test.tsx +41 -0
  20. package/tests/jest/components/ConfigPage.test.tsx +58 -0
  21. package/tests/jest/components/CustomListPage.test.tsx +57 -0
  22. package/tests/jest/components/CustomListSearch.test.tsx +275 -0
  23. package/tests/jest/components/CustomListsSidebar.test.tsx +251 -0
  24. package/tests/jest/components/DashboardPage.test.tsx +76 -0
  25. package/tests/jest/components/DebugAuthentication.test.tsx +1 -5
  26. package/tests/jest/components/DiagnosticsTabContainer.test.tsx +147 -0
  27. package/tests/jest/components/EditableConfigList.test.tsx +8 -2
  28. package/tests/jest/components/EntryPointsContainer.test.tsx +97 -0
  29. package/tests/jest/components/EntryPointsTabs.test.tsx +88 -0
  30. package/tests/jest/components/ErrorMessage.test.tsx +97 -0
  31. package/tests/jest/components/Footer.test.tsx +141 -0
  32. package/tests/jest/components/InventoryReportRequestModal.test.tsx +16 -42
  33. package/tests/jest/components/JsonField.test.tsx +20 -0
  34. package/tests/jest/components/LaneEditor.test.tsx +2 -6
  35. package/tests/jest/components/LanePage.test.tsx +68 -0
  36. package/tests/jest/components/LanguageField.test.tsx +40 -0
  37. package/tests/jest/components/LoadButton.test.tsx +49 -0
  38. package/tests/jest/components/ManagePatrons.test.tsx +73 -0
  39. package/tests/jest/components/ManagePatronsForm.test.tsx +180 -0
  40. package/tests/jest/components/ManagePatronsTabContainer.test.tsx +143 -0
  41. package/tests/jest/components/MetadataServices.test.tsx +59 -0
  42. package/tests/jest/components/PatronBlockingRulesEditor.test.tsx +3 -1
  43. package/tests/jest/components/PatronInfo.test.tsx +54 -0
  44. package/tests/jest/components/ProtocolFormField.test.tsx +36 -0
  45. package/tests/jest/components/SaveButton.test.tsx +47 -0
  46. package/tests/jest/components/SelfTestResult.test.tsx +164 -0
  47. package/tests/jest/components/SelfTestsCategory.test.tsx +200 -0
  48. package/tests/jest/components/ServiceWithRegistrationsEditForm.test.tsx +110 -0
  49. package/tests/jest/components/SetupPage.test.tsx +41 -0
  50. package/tests/jest/components/SingleStatListItem.test.tsx +62 -0
  51. package/tests/jest/components/Stats.test.tsx +4 -8
  52. package/tests/jest/components/TabContainer.test.tsx +68 -0
  53. package/tests/jest/components/Timestamp.test.tsx +74 -0
  54. package/tests/jest/components/TroubleshootingTabContainer.test.tsx +68 -0
  55. package/tests/jest/components/UpdatingLoader.test.tsx +36 -0
  56. package/tests/jest/components/WelcomePage.test.tsx +43 -0
  57. package/tests/jest/components/WithEditButton.test.tsx +55 -0
  58. package/tests/jest/components/WithRemoveButton.test.tsx +95 -0
  59. package/tests/jest/editorAdapter.test.ts +245 -0
  60. package/tests/jest/index.test.tsx +50 -0
  61. package/tests/jest/legacy-setup.ts +13 -0
  62. package/tests/jest/legacyJsdomEnvironment.js +49 -0
  63. package/tests/jest/models/Admin.test.ts +206 -0
  64. package/tests/jest/reducers/bookCoverPreview.test.ts +81 -0
  65. package/tests/jest/reducers/classifications.test.ts +161 -0
  66. package/tests/jest/reducers/collections.test.ts +96 -0
  67. package/tests/jest/reducers/complaints.test.ts +166 -0
  68. package/tests/jest/reducers/createFetchEditReducer.test.ts +220 -0
  69. package/tests/jest/reducers/createRegisterLibraryReducer.test.ts +51 -0
  70. package/tests/jest/reducers/customListDetails.test.ts +120 -0
  71. package/tests/jest/reducers/customListEditor.test.ts +2823 -0
  72. package/tests/jest/reducers/managePatrons.test.ts +71 -0
  73. package/tests/jest/testUtils/formDataShim.test.ts +135 -0
  74. package/tests/jest/testUtils/formDataShim.ts +112 -0
  75. package/tests/jest/utils/sharedFunctions.test.ts +121 -0
  76. package/tsconfig.json +3 -4
  77. package/testReporter.js +0 -29
  78. package/tests/jest/components/AdvancedSearchBuilder.test.tsx +0 -38
package/.node-version CHANGED
@@ -1 +1 @@
1
- 20.18.3
1
+ 24.16.0
package/.nvmrc CHANGED
@@ -1 +1 @@
1
- v20
1
+ v24
package/CLAUDE.md CHANGED
@@ -16,13 +16,16 @@ npm run dev-server -- --env=backend=https://your-cm-url # Dev server against re
16
16
  npm run prod # Production build
17
17
  npm run lint # Run ESLint (lint:js) + sass-lint
18
18
  npm run lint:js # Run ESLint over the whole tree (eslint . --max-warnings 0)
19
- npm test # Full test suite (mocha legacy + jest)
20
- npm run test-jest # Jest tests only
21
- npm run test-jest-file <path> # Single jest test: npm run test-jest-file tests/jest/components/MyTest.test.tsx
22
- npm run test-file-ts <path> # Single mocha test: npm run test-file-ts src/components/__tests__/MyTest-test.tsx
19
+ npm test # Full test suite (both jest projects)
20
+ npm run test-jest-file <path> # Single test: npm run test-jest-file tests/jest/components/MyTest.test.tsx
21
+ npm run coverage # Test suite with coverage (what CI runs); writes coverage/jest/lcov.info
23
22
  npm run dev-test-axe # Dev build with react-axe accessibility checking (output in browser console)
24
23
  ```
25
24
 
25
+ Run one jest project at a time with `npx jest --selectProjects=unit` (or `=legacy`). Note
26
+ `--selectProjects` is variadic, so put file paths behind `--testPathPattern` rather than
27
+ after it as positional arguments.
28
+
26
29
  The dev server can also read the backend URL from `.env` or `.env.local` with `BACKEND=https://...`.
27
30
 
28
31
  ## Architecture
@@ -62,11 +65,17 @@ The dev server can also read the backend URL from `.env` or `.env.local` with `B
62
65
 
63
66
  ## Testing
64
67
 
65
- **Two test systems coexist:**
68
+ Everything runs under jest, split into **two jest `projects`** (see `jest.config.js`):
69
+
70
+ 1. **`unit`** (for all new tests): Tests in `tests/jest/` mirroring `src/` structure. Uses React Testing Library, jest-dom, and MSW for API mocking. Test utilities in `tests/jest/testUtils/withProviders.tsx` provide `renderWithProviders()` and `componentWithProviders()` to wrap components with Redux, Context, and QueryClient. Runs on `jest-fixed-jsdom` so MSW can intercept `fetch`.
71
+
72
+ 2. **`legacy`**: Tests in `src/*/__tests__/` directories, still written with Enzyme, chai, and sinon. Being rewritten as `unit` tests; **do not add new ones**. Runs on `tests/jest/legacyJsdomEnvironment.js` — plain jsdom, because `jest-fixed-jsdom` substitutes undici's `FormData`, which rejects `new FormData(formElement)`. That environment also restores `global.jsdom` and tolerates unhandled promise rejections; both are documented in the file. Delete the project, the environment, and `tests/jest/legacy-setup.ts` along with the last enzyme test — that is what unblocks React 17+, since enzyme has no adapter beyond React 16.
73
+
74
+ Both projects need `testEnvironmentOptions.customExportConditions: [""]`. Without it, jsdom's default `["browser"]` condition resolves **sinon** to its ESM bundle and every suite that imports it fails to parse.
66
75
 
67
- 1. **Jest** (for all new tests): Tests in `tests/jest/` mirroring `src/` structure. Uses React Testing Library, jest-dom, and MSW for API mocking. Test utilities in `tests/jest/testUtils/withProviders.tsx` provide `renderWithProviders()` and `componentWithProviders()` to wrap components with Redux, Context, and QueryClient.
76
+ **Coverage:** Reported to Codecov under the `jest` flag. `collectCoverageFrom` must stay at the _top level_ of `jest.config.js`, not inside `projects` — jest reads it off the global config, and setting it per-project leaves it globally undefined, so every executed file gets instrumented (including `tests/` helpers).
68
77
 
69
- 2. **Mocha** (legacy): Tests in `src/*/__tests__/` directories. Uses Enzyme with React 16 adapter. Do not add new mocha tests.
78
+ Jest's `roots` must keep `<rootDir>/src` so `collectCoverageFrom` can discover source files no test imports; otherwise they are silently omitted rather than counted as uncovered, and the reported percentage rises while real coverage is unchanged.
70
79
 
71
80
  ## Code Style
72
81
 
@@ -79,7 +88,7 @@ The dev server can also read the backend URL from `.env` or `.env.local` with `B
79
88
 
80
89
  ## Output
81
90
 
82
- Webpack builds to `dist/circulation-admin.js` (UMD library, global `CirculationAdmin`) and `dist/circulation-admin.css`. Node.js 20+ required.
91
+ Webpack builds to `dist/circulation-admin.js` (UMD library, global `CirculationAdmin`) and `dist/circulation-admin.css`. Node.js 24 required (>=24.0.0 <25.0.0).
83
92
 
84
93
  ## Code Conventions
85
94
 
package/README.md CHANGED
@@ -12,7 +12,7 @@ To see screenshots, read in-depth documentation, and find out more about the pro
12
12
 
13
13
  This package may be used in a local build of the Palace Project [Circulation Manager](https://github.com/ThePalaceProject/circulation), or it may be run against a remote Circulation Manager.
14
14
 
15
- This project uses Node.js 20. We recommend the latest version of Node.js 20.
15
+ This project uses Node.js 24. We recommend the latest version of Node.js 24.
16
16
 
17
17
  You have a number of options for installing Node.js. One convenient way on macOS is to use Homebrew and nvm to manage Node.js versions.
18
18
 
@@ -28,22 +28,22 @@ Install nvm using Homebrew:
28
28
  brew install nvm
29
29
  ```
30
30
 
31
- Install and use the latest version of Node.js 18, e.g. 18.14.2 with nvm:
31
+ Install and use the latest version of Node.js 24, e.g. 24.16.0 with nvm:
32
32
 
33
33
  ```
34
- nvm install 20.18.3
35
- nvm use 20.18.3
34
+ nvm install 24.16.0
35
+ nvm use 24.16.0
36
36
  ```
37
37
 
38
38
  Alternatively, you can use `nodenv` on macOS:
39
39
 
40
40
  ```
41
41
  brew install nodenv
42
- nodenv install 20.18.3
43
- nodenv global 20.18.3
42
+ nodenv install 24.16.0
43
+ nodenv global 24.16.0
44
44
  ```
45
45
 
46
- If you have different projects requiring different Node.js versions, you can use nodenv to set a local version for the project by navigating to the root directory of circulation-admin and executing `nodenv local 18.14.2`.
46
+ If you have different projects requiring different Node.js versions, you can use nodenv to set a local version for the project by navigating to the root directory of circulation-admin and executing `nodenv local 24.16.0`.
47
47
 
48
48
  You can also use the `n` npm package to manage Node.js versions, or simply install the Node.js binary directly.
49
49