Skip to content

Commit 4cfbd75

Browse files
authored
chore: Cleanup warnings in unit tests (#1273)
This PR fixes the following warnings from our unit tests, which were cluttering up the output: - The regex warning is fixed by removing the /g global flag from element selectors - The deprecation warning is fixed by the package upgrade <img width="1156" height="184" alt="Screenshot 2025-10-16 at 9 06 57 AM" src="https://github.com/user-attachments/assets/37b6c408-e453-4fb8-baf9-323bbd79e53c" /> <img width="1445" height="191" alt="Screenshot 2025-10-16 at 9 06 50 AM" src="https://github.com/user-attachments/assets/71388182-5e4f-42c1-ae18-026c8d963e1f" />
1 parent 3c8f3b5 commit 4cfbd75

File tree

3 files changed

+50
-26
lines changed

3 files changed

+50
-26
lines changed

packages/app/package.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,8 +117,9 @@
117117
"@storybook/nextjs": "^8.1.5",
118118
"@storybook/react": "^8.1.5",
119119
"@storybook/test": "^8.1.5",
120+
"@testing-library/dom": "^10.4.1",
120121
"@testing-library/jest-dom": "^6.4.2",
121-
"@testing-library/react": "^14.2.1",
122+
"@testing-library/react": "^16.3.0",
122123
"@testing-library/user-event": "^14.5.2",
123124
"@types/crypto-js": "^4",
124125
"@types/identity-obj-proxy": "^3",

packages/app/src/components/__tests__/DBSearchPageFilters.test.tsx

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -228,7 +228,7 @@ describe('FilterGroup', () => {
228228
it('should sort options alphabetically by default', () => {
229229
renderWithMantine(<FilterGroup {...defaultProps} />);
230230

231-
const options = screen.getAllByTestId(/filter-checkbox-input/g);
231+
const options = screen.getAllByTestId(/filter-checkbox-input/);
232232
expect(options).toHaveLength(3);
233233
const labels = screen.getAllByText(/apple|banana|zebra/);
234234
expect(labels[0]).toHaveTextContent('apple');
@@ -247,7 +247,7 @@ describe('FilterGroup', () => {
247247
/>,
248248
);
249249

250-
const options = screen.getAllByTestId(/filter-checkbox-input/g);
250+
const options = screen.getAllByTestId(/filter-checkbox-input/);
251251
expect(options).toHaveLength(3);
252252
const labels = screen.getAllByText(/apple|banana|zebra/);
253253
expect(labels[0]).toHaveTextContent('apple');
@@ -276,7 +276,7 @@ describe('FilterGroup', () => {
276276
/>,
277277
);
278278

279-
const options = screen.getAllByTestId(/filter-checkbox-input/g);
279+
const options = screen.getAllByTestId(/filter-checkbox-input/);
280280
expect(options).toHaveLength(3);
281281
const labels = screen.getAllByText(/apple|banana|zebra/);
282282
expect(labels[0]).toHaveTextContent('banana'); // Selected
@@ -309,7 +309,7 @@ describe('FilterGroup', () => {
309309
);
310310
await userEvent.click(showPercentages);
311311

312-
const options = screen.getAllByTestId(/filter-checkbox-input/g);
312+
const options = screen.getAllByTestId(/filter-checkbox-input/);
313313
expect(options).toHaveLength(3);
314314
const labels = screen.getAllByText(/%/);
315315
expect(labels[0]).toHaveTextContent('~99%'); // apple
@@ -328,7 +328,7 @@ describe('FilterGroup', () => {
328328
/>,
329329
);
330330

331-
const options = screen.getAllByTestId(/filter-checkbox-input/g);
331+
const options = screen.getAllByTestId(/filter-checkbox-input/);
332332
expect(options).toHaveLength(3);
333333
const labels = screen.getAllByText(/apple|banana|zebra/);
334334
expect(labels[0]).toHaveTextContent('apple'); // included first
@@ -359,7 +359,7 @@ describe('FilterGroup', () => {
359359
);
360360

361361
// Should show MAX_FILTER_GROUP_ITEMS (10) by default
362-
let options = screen.getAllByTestId(/filter-checkbox-input/g);
362+
let options = screen.getAllByTestId(/filter-checkbox-input/);
363363
expect(options).toHaveLength(10);
364364

365365
// Selected items should be visible even if they would be beyond MAX_FILTER_GROUP_ITEMS
@@ -372,7 +372,7 @@ describe('FilterGroup', () => {
372372
await userEvent.click(showMoreButton);
373373

374374
// Should show all items
375-
options = screen.getAllByTestId(/filter-checkbox-input/g);
375+
options = screen.getAllByTestId(/filter-checkbox-input/);
376376
expect(options).toHaveLength(15);
377377
});
378378

yarn.lock

Lines changed: 41 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -4589,8 +4589,9 @@ __metadata:
45894589
"@tanstack/react-query-devtools": "npm:^5.56.2"
45904590
"@tanstack/react-table": "npm:^8.7.9"
45914591
"@tanstack/react-virtual": "npm:^3.0.1"
4592+
"@testing-library/dom": "npm:^10.4.1"
45924593
"@testing-library/jest-dom": "npm:^6.4.2"
4593-
"@testing-library/react": "npm:^14.2.1"
4594+
"@testing-library/react": "npm:^16.3.0"
45944595
"@testing-library/user-event": "npm:^14.5.2"
45954596
"@types/crypto-js": "npm:^4"
45964597
"@types/identity-obj-proxy": "npm:^3"
@@ -9467,7 +9468,23 @@ __metadata:
94679468
languageName: node
94689469
linkType: hard
94699470

9470-
"@testing-library/dom@npm:^9.0.0, @testing-library/dom@npm:^9.3.4":
9471+
"@testing-library/dom@npm:^10.4.1":
9472+
version: 10.4.1
9473+
resolution: "@testing-library/dom@npm:10.4.1"
9474+
dependencies:
9475+
"@babel/code-frame": "npm:^7.10.4"
9476+
"@babel/runtime": "npm:^7.12.5"
9477+
"@types/aria-query": "npm:^5.0.1"
9478+
aria-query: "npm:5.3.0"
9479+
dom-accessibility-api: "npm:^0.5.9"
9480+
lz-string: "npm:^1.5.0"
9481+
picocolors: "npm:1.1.1"
9482+
pretty-format: "npm:^27.0.2"
9483+
checksum: 10c0/19ce048012d395ad0468b0dbcc4d0911f6f9e39464d7a8464a587b29707eed5482000dad728f5acc4ed314d2f4d54f34982999a114d2404f36d048278db815b1
9484+
languageName: node
9485+
linkType: hard
9486+
9487+
"@testing-library/dom@npm:^9.3.4":
94719488
version: 9.3.4
94729489
resolution: "@testing-library/dom@npm:9.3.4"
94739490
dependencies:
@@ -9516,17 +9533,23 @@ __metadata:
95169533
languageName: node
95179534
linkType: hard
95189535

9519-
"@testing-library/react@npm:^14.2.1":
9520-
version: 14.2.1
9521-
resolution: "@testing-library/react@npm:14.2.1"
9536+
"@testing-library/react@npm:^16.3.0":
9537+
version: 16.3.0
9538+
resolution: "@testing-library/react@npm:16.3.0"
95229539
dependencies:
95239540
"@babel/runtime": "npm:^7.12.5"
9524-
"@testing-library/dom": "npm:^9.0.0"
9525-
"@types/react-dom": "npm:^18.0.0"
95269541
peerDependencies:
9527-
react: ^18.0.0
9528-
react-dom: ^18.0.0
9529-
checksum: 10c0/83b35cf8bf5640f1b63b32223ebc75799dc1a8e034d819120b26838fba0b0ab10bdbe6ad07dd8ae8287365f2b0c52dc9892a6fa11bb24d3e63ad97dfb7f2f296
9542+
"@testing-library/dom": ^10.0.0
9543+
"@types/react": ^18.0.0 || ^19.0.0
9544+
"@types/react-dom": ^18.0.0 || ^19.0.0
9545+
react: ^18.0.0 || ^19.0.0
9546+
react-dom: ^18.0.0 || ^19.0.0
9547+
peerDependenciesMeta:
9548+
"@types/react":
9549+
optional: true
9550+
"@types/react-dom":
9551+
optional: true
9552+
checksum: 10c0/3a2cb1f87c9a67e1ebbbcfd99b94b01e496fc35147be8bc5d8bf07a699c7d523a09d57ef2f7b1d91afccd1a28e21eda3b00d80187fbb51b1de01e422592d845e
95309553
languageName: node
95319554
linkType: hard
95329555

@@ -11860,7 +11883,7 @@ __metadata:
1186011883
languageName: node
1186111884
linkType: hard
1186211885

11863-
"aria-query@npm:^5.3.0":
11886+
"aria-query@npm:5.3.0, aria-query@npm:^5.3.0":
1186411887
version: 5.3.0
1186511888
resolution: "aria-query@npm:5.3.0"
1186611889
dependencies:
@@ -23538,6 +23561,13 @@ __metadata:
2353823561
languageName: node
2353923562
linkType: hard
2354023563

23564+
"picocolors@npm:1.1.1, picocolors@npm:^1.1.1":
23565+
version: 1.1.1
23566+
resolution: "picocolors@npm:1.1.1"
23567+
checksum: 10c0/e2e3e8170ab9d7c7421969adaa7e1b31434f789afb9b3f115f6b96d91945041ac3ceb02e9ec6fe6510ff036bcc0bf91e69a1772edc0b707e12b19c0f2d6bcf58
23568+
languageName: node
23569+
linkType: hard
23570+
2354123571
"picocolors@npm:^1.0.0":
2354223572
version: 1.0.0
2354323573
resolution: "picocolors@npm:1.0.0"
@@ -23552,13 +23582,6 @@ __metadata:
2355223582
languageName: node
2355323583
linkType: hard
2355423584

23555-
"picocolors@npm:^1.1.1":
23556-
version: 1.1.1
23557-
resolution: "picocolors@npm:1.1.1"
23558-
checksum: 10c0/e2e3e8170ab9d7c7421969adaa7e1b31434f789afb9b3f115f6b96d91945041ac3ceb02e9ec6fe6510ff036bcc0bf91e69a1772edc0b707e12b19c0f2d6bcf58
23559-
languageName: node
23560-
linkType: hard
23561-
2356223585
"picomatch@npm:4.0.2, picomatch@npm:^4.0.1, picomatch@npm:^4.0.2":
2356323586
version: 4.0.2
2356423587
resolution: "picomatch@npm:4.0.2"

0 commit comments

Comments
 (0)