Skip to content

Commit 0985471

Browse files
aryaemami59markerikson
authored andcommitted
Export IS_REACT_19 and re-use in tests
1 parent 7d8dd84 commit 0985471

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

test/components/connect.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
/*eslint-disable react/prop-types*/
22

3+
import { IS_REACT_19 } from '@internal/utils/react-is'
34
import * as rtl from '@testing-library/react'
45
import type { Dispatch, ElementType, JSX, MouseEvent, ReactNode } from 'react'
56
import React, { Component } from 'react'
@@ -2904,7 +2905,7 @@ describe('React', () => {
29042905
</React.StrictMode>,
29052906
)
29062907

2907-
if (IS_REACT_18) {
2908+
if (IS_REACT_18 || IS_REACT_19) {
29082909
expect(spy).not.toHaveBeenCalled()
29092910
} else {
29102911
expect(spy.mock.calls[0]?.[0]).toEqual(

test/hooks/useSelector.spec.tsx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
/*eslint-disable react/prop-types*/
22

33
import type { UseSelectorOptions } from '@internal/hooks/useSelector'
4+
import { IS_REACT_19 } from '@internal/utils/react-is'
45
import * as rtl from '@testing-library/react'
56
import type { DispatchWithoutAction, FunctionComponent, ReactNode } from 'react'
67
import React, {
@@ -722,7 +723,7 @@ describe('React', () => {
722723
// although I can't imagine why, and if I remove the `useSelector` calls both tests drop to ~50ms.
723724
// So, we'll modify our expectations here depending on whether this is an 18 or 17 compat test,
724725
// and give some buffer time to allow for variations in test machines.
725-
const expectedMaxUnmountTime = IS_REACT_18 ? 500 : 7000
726+
const expectedMaxUnmountTime = IS_REACT_18 || IS_REACT_19 ? 500 : 7000
726727
expect(elapsedTime).toBeLessThan(expectedMaxUnmountTime)
727728
})
728729

0 commit comments

Comments
 (0)