Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
N
next.js
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Alex
next.js
Commits
1f09a78e
Unverified
Commit
1f09a78e
authored
Jun 14, 2021
by
Gerald Monaco
Committed by
GitHub
Jun 14, 2021
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix react@next and react@experimental tests (#26088)
parent
1ebf26af
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
14 additions
and
3 deletions
+14
-3
test_react_next.yml
.github/workflows/test_react_next.yml
+1
-0
link-warnings.test.js
test/unit/link-warnings.test.js
+13
-3
No files found.
.github/workflows/test_react_next.yml
View file @
1f09a78e
...
...
@@ -31,6 +31,7 @@ jobs:
NEXT_TELEMETRY_DISABLED
:
1
HEADLESS
:
true
NEXT_PRIVATE_SKIP_SIZE_TESTS
:
true
NEXT_PRIVATE_REACT_ROOT
:
1
strategy
:
fail-fast
:
false
matrix
:
...
...
test/unit/link-warnings.test.js
View file @
1f09a78e
...
...
@@ -3,11 +3,21 @@
*/
import
{
act
,
render
}
from
'@testing-library/react'
import
Link
from
'next/link'
import
React
from
'react'
import
{
getPackageVersion
}
from
'next/dist/lib/get-package-version'
import
semver
from
'next/dist/compiled/semver'
describe
(
'<Link/>'
,
()
=>
{
let
spy
beforeAll
(()
=>
{
let
expectedErrors
beforeAll
(
async
()
=>
{
spy
=
jest
.
spyOn
(
console
,
'error'
).
mockImplementation
(()
=>
{})
const
reactVersion
=
await
getPackageVersion
({
cwd
:
__dirname
,
name
:
'react-dom'
,
})
expectedErrors
=
reactVersion
&&
semver
.
gte
(
reactVersion
,
'18.0.0'
)
?
1
:
0
})
it
(
'test link with unmount'
,
()
=>
{
...
...
@@ -16,7 +26,7 @@ describe('<Link/>', () => {
unmount
()
})
expect
(
spy
).
not
.
toHaveBeenCalled
(
)
expect
(
spy
).
toHaveBeenCalledTimes
(
expectedErrors
)
})
it
(
'test link without unmount'
,
()
=>
{
...
...
@@ -24,7 +34,7 @@ describe('<Link/>', () => {
render
(
<
Link
href
=
"/"
>
hello
<
/Link>
)
})
expect
(
spy
).
not
.
toHaveBeenCalled
(
)
expect
(
spy
).
toHaveBeenCalledTimes
(
expectedErrors
)
})
afterAll
(()
=>
{
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment