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
31f3bfa1
Commit
31f3bfa1
authored
Dec 30, 2019
by
JJ Kasper
Committed by
Joe Haddad
Dec 30, 2019
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add test ensuring basePath is added to routes-manifest (#9885)
parent
078b2a5e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
89 deletions
+35
-89
index.test.js
test/integration/basepath/test/index.test.js
+35
-89
No files found.
test/integration/basepath/test/index.test.js
View file @
31f3bfa1
...
@@ -17,23 +17,27 @@ import {
...
@@ -17,23 +17,27 @@ import {
File
,
File
,
nextStart
,
nextStart
,
}
from
'next-test-utils'
}
from
'next-test-utils'
import
{
readFileSync
,
writeFileSync
,
renameSync
,
existsSync
}
from
'fs'
import
fs
,
{
readFileSync
,
writeFileSync
,
renameSync
,
existsSync
,
}
from
'fs-extra'
import
cheerio
from
'cheerio'
import
cheerio
from
'cheerio'
jasmine
.
DEFAULT_TIMEOUT_INTERVAL
=
1000
*
60
*
5
jasmine
.
DEFAULT_TIMEOUT_INTERVAL
=
1000
*
60
*
2
describe
(
'basePath development'
,
()
=>
{
const
appDir
=
join
(
__dirname
,
'..'
)
let
server
let
context
=
{}
beforeAll
(
async
()
=>
{
const
runTests
=
(
context
,
dev
=
false
)
=>
{
context
.
appPort
=
await
findPort
()
if
(
!
dev
)
{
server
=
await
launchApp
(
join
(
__dirname
,
'..'
),
context
.
appPort
)
it
(
'should add basePath to routes-manifest'
,
async
()
=>
{
})
const
routesManifest
=
await
fs
.
readJSON
(
afterAll
(
async
()
=>
{
join
(
appDir
,
'.next/routes-manifest.json'
)
await
killApp
(
server
)
)
})
expect
(
routesManifest
.
basePath
).
toBe
(
'/docs'
)
})
}
it
(
'should show the hello page under the /docs prefix'
,
async
()
=>
{
it
(
'should show the hello page under the /docs prefix'
,
async
()
=>
{
const
browser
=
await
webdriver
(
context
.
appPort
,
'/docs/hello'
)
const
browser
=
await
webdriver
(
context
.
appPort
,
'/docs/hello'
)
...
@@ -72,6 +76,22 @@ describe('basePath development', () => {
...
@@ -72,6 +76,22 @@ describe('basePath development', () => {
await
browser
.
close
()
await
browser
.
close
()
}
}
})
})
}
describe
(
'basePath development'
,
()
=>
{
let
server
let
context
=
{}
beforeAll
(
async
()
=>
{
context
.
appPort
=
await
findPort
()
server
=
await
launchApp
(
join
(
__dirname
,
'..'
),
context
.
appPort
)
})
afterAll
(
async
()
=>
{
await
killApp
(
server
)
})
runTests
(
context
,
true
)
describe
(
'Hot Module Reloading'
,
()
=>
{
describe
(
'Hot Module Reloading'
,
()
=>
{
describe
(
'delete a page and add it back'
,
()
=>
{
describe
(
'delete a page and add it back'
,
()
=>
{
...
@@ -379,7 +399,6 @@ describe('basePath development', () => {
...
@@ -379,7 +399,6 @@ describe('basePath development', () => {
})
})
describe
(
'basePath production'
,
()
=>
{
describe
(
'basePath production'
,
()
=>
{
const
appDir
=
join
(
__dirname
,
'../'
)
let
context
=
{}
let
context
=
{}
let
server
let
server
let
app
let
app
...
@@ -398,47 +417,10 @@ describe('basePath production', () => {
...
@@ -398,47 +417,10 @@ describe('basePath production', () => {
afterAll
(()
=>
stopApp
(
server
))
afterAll
(()
=>
stopApp
(
server
))
it
(
'should show the hello page under the /docs prefix'
,
async
()
=>
{
runTests
(
context
)
const
browser
=
await
webdriver
(
context
.
appPort
,
'/docs/hello'
)
try
{
const
text
=
await
browser
.
elementByCss
(
'h1'
).
text
()
expect
(
text
).
toBe
(
'Hello World'
)
}
finally
{
await
browser
.
close
()
}
})
it
(
'should show the other-page page under the /docs prefix'
,
async
()
=>
{
const
browser
=
await
webdriver
(
context
.
appPort
,
'/docs/other-page'
)
try
{
const
text
=
await
browser
.
elementByCss
(
'h1'
).
text
()
expect
(
text
).
toBe
(
'Hello Other'
)
}
finally
{
await
browser
.
close
()
}
})
it
(
'should navigate to the page without refresh'
,
async
()
=>
{
const
browser
=
await
webdriver
(
context
.
appPort
,
'/docs/hello'
)
try
{
await
browser
.
eval
(
'window.itdidnotrefresh = "hello"'
)
const
text
=
await
browser
.
elementByCss
(
'#other-page-link'
)
.
click
()
.
waitForElementByCss
(
'#other-page-title'
)
.
elementByCss
(
'h1'
)
.
text
()
expect
(
text
).
toBe
(
'Hello Other'
)
expect
(
await
browser
.
eval
(
'window.itdidnotrefresh'
)).
toBe
(
'hello'
)
}
finally
{
await
browser
.
close
()
}
})
})
})
describe
(
'basePath serverless'
,
()
=>
{
describe
(
'basePath serverless'
,
()
=>
{
const
appDir
=
join
(
__dirname
,
'../'
)
let
context
=
{}
let
context
=
{}
let
app
let
app
...
@@ -457,41 +439,5 @@ describe('basePath serverless', () => {
...
@@ -457,41 +439,5 @@ describe('basePath serverless', () => {
await
nextConfig
.
restore
()
await
nextConfig
.
restore
()
})
})
it
(
'should show the hello page under the /docs prefix'
,
async
()
=>
{
runTests
(
context
)
const
browser
=
await
webdriver
(
context
.
appPort
,
'/docs/hello'
)
try
{
const
text
=
await
browser
.
elementByCss
(
'h1'
).
text
()
expect
(
text
).
toBe
(
'Hello World'
)
}
finally
{
await
browser
.
close
()
}
})
it
(
'should show the other-page page under the /docs prefix'
,
async
()
=>
{
const
browser
=
await
webdriver
(
context
.
appPort
,
'/docs/other-page'
)
try
{
const
text
=
await
browser
.
elementByCss
(
'h1'
).
text
()
expect
(
text
).
toBe
(
'Hello Other'
)
}
finally
{
await
browser
.
close
()
}
})
it
(
'should navigate to the page without refresh'
,
async
()
=>
{
const
browser
=
await
webdriver
(
context
.
appPort
,
'/docs/hello'
)
try
{
await
browser
.
eval
(
'window.itdidnotrefresh = "hello"'
)
const
text
=
await
browser
.
elementByCss
(
'#other-page-link'
)
.
click
()
.
waitForElementByCss
(
'#other-page-title'
)
.
elementByCss
(
'h1'
)
.
text
()
expect
(
text
).
toBe
(
'Hello Other'
)
expect
(
await
browser
.
eval
(
'window.itdidnotrefresh'
)).
toBe
(
'hello'
)
}
finally
{
await
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