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
bf882eb6
Commit
bf882eb6
authored
Jun 18, 2018
by
Alexander
Committed by
Tim Neutkens
Jun 18, 2018
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Failing test for #4620 (#4625)
Failing test for #4620
parent
c4d0b212
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
72 additions
and
0 deletions
+72
-0
_app.js
test/integration/app-aspath/pages/_app.js
+16
-0
index.js
test/integration/app-aspath/pages/index.js
+1
-0
index.test.js
test/integration/app-aspath/test/index.test.js
+55
-0
No files found.
test/integration/app-aspath/pages/_app.js
0 → 100644
View file @
bf882eb6
import
React
from
'react'
import
App
,
{
Container
}
from
'next/app'
export
default
class
MyApp
extends
App
{
// find this
static
async
getInitialProps
({
ctx
})
{
const
{
query
,
pathname
,
asPath
}
=
ctx
return
{
url
:
{
query
,
pathname
,
asPath
}}
}
render
()
{
const
{
Component
,
url
}
=
this
.
props
return
<
Container
><
Component
url
=
{
url
}
/></
Container
>
}
}
test/integration/app-aspath/pages/index.js
0 → 100644
View file @
bf882eb6
export
default
props
=>
JSON
.
stringify
(
props
,
null
,
2
)
test/integration/app-aspath/test/index.test.js
0 → 100644
View file @
bf882eb6
/* global jasmine, describe, it, expect, beforeAll, afterAll */
import
webdriver
from
'next-webdriver'
import
{
readFileSync
,
writeFileSync
}
from
'fs'
import
{
join
}
from
'path'
import
{
renderViaHTTP
,
findPort
,
launchApp
,
killApp
,
waitFor
}
from
'next-test-utils'
let
appPort
let
server
jasmine
.
DEFAULT_TIMEOUT_INTERVAL
=
1000
*
60
*
5
describe
(
'App asPath'
,
()
=>
{
beforeAll
(
async
()
=>
{
appPort
=
await
findPort
()
server
=
await
launchApp
(
join
(
__dirname
,
'../'
),
appPort
,
true
)
// pre-build all pages at the start
await
Promise
.
all
([
renderViaHTTP
(
appPort
,
'/'
)
])
})
afterAll
(()
=>
killApp
(
server
))
it
(
'should not have any changes in asPath after a bundle rebuild'
,
async
()
=>
{
const
browser
=
await
webdriver
(
appPort
,
'/'
)
const
appPath
=
join
(
__dirname
,
'../'
,
'pages'
,
'_app.js'
)
const
originalContent
=
readFileSync
(
appPath
,
'utf8'
)
try
{
const
text
=
await
browser
.
elementByCss
(
'body'
).
text
()
expect
(
text
).
toBe
(
'{ "url": { "query": {}, "pathname": "/", "asPath": "/" } }'
)
const
editedContent
=
originalContent
.
replace
(
'find this'
,
'replace with this'
)
// Change the content to trigger a bundle rebuild
await
writeFileSync
(
appPath
,
editedContent
,
'utf8'
)
// Wait for the bundle rebuild
await
waitFor
(
5000
)
const
newContent
=
await
browser
.
elementByCss
(
'body'
).
text
()
expect
(
newContent
).
toBe
(
'{ "url": { "query": {}, "pathname": "/", "asPath": "/" } }'
)
}
finally
{
// Change back to the original content
writeFileSync
(
appPath
,
originalContent
,
'utf8'
)
browser
.
close
()
}
})
})
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