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
9855fd7b
Unverified
Commit
9855fd7b
authored
Dec 19, 2022
by
Jiachi Liu
Committed by
GitHub
Dec 19, 2022
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
test: add test for notFound during streaming (#44078)
Add test for notFound case added in #41735
parent
13a9fb99
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
55 additions
and
0 deletions
+55
-0
page.js
test/e2e/app-dir/app/app/not-found/suspense/page.js
+41
-0
index.test.ts
test/e2e/app-dir/index.test.ts
+14
-0
No files found.
test/e2e/app-dir/app/app/not-found/suspense/page.js
0 → 100644
View file @
9855fd7b
import
{
Suspense
}
from
'react'
import
{
notFound
}
from
'next/navigation'
function
createSuspenseyComponent
(
Component
,
{
timeout
=
0
,
expire
=
10
})
{
let
result
let
promise
return
function
Data
()
{
if
(
result
)
return
result
if
(
!
promise
)
promise
=
new
Promise
((
resolve
)
=>
{
setTimeout
(()
=>
{
result
=
<
Component
/>
setTimeout
(()
=>
{
result
=
undefined
promise
=
undefined
},
expire
)
resolve
()
},
timeout
)
})
throw
promise
}
}
function
NotFound
()
{
notFound
()
return
<><
/
>
}
const
SuspenseyNotFound
=
createSuspenseyComponent
(
NotFound
,
{
timeout
:
300
,
})
export
default
function
()
{
return
(
<
div
className
=
"suspense"
>
<
Suspense
fallback
=
"fallback"
>
<
SuspenseyNotFound
/>
<
/Suspense
>
<
/div
>
)
}
test/e2e/app-dir/index.test.ts
View file @
9855fd7b
...
...
@@ -2364,6 +2364,20 @@ createNextDescribe(
.
getAttribute
(
'content'
)
).
toBe
(
'noindex'
)
})
it
(
'should trigger not-found while streaming'
,
async
()
=>
{
const
initialHtml
=
await
next
.
render
(
'/not-found/suspense'
)
expect
(
initialHtml
).
not
.
toContain
(
'noindex'
)
const
browser
=
await
next
.
browser
(
'/not-found/suspense'
)
expect
(
await
browser
.
waitForElementByCss
(
'#not-found-component'
).
text
()
).
toBe
(
'Not Found!'
)
expect
(
await
browser
.
waitForElementByCss
(
'meta[name="robots"]'
)
.
getAttribute
(
'content'
)
).
toBe
(
'noindex'
)
})
})
describe
(
'bots'
,
()
=>
{
...
...
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