Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add e2e tests for
static.directory
option (#3802)
- Loading branch information
Showing
4 changed files
with
986 additions
and
399 deletions.
There are no files selected for viewing
149 changes: 149 additions & 0 deletions
149
test/e2e/__snapshots__/static-directory.test.js.snap.webpack4
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`static.directory option defaults to PWD should handle request to /index.html: console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option defaults to PWD should handle request to /index.html: page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option defaults to PWD should handle request to /index.html: response status 1`] = `200`; | ||
|
||
exports[`static.directory option defaults to PWD should handle request to /index.html: response text 1`] = ` | ||
"Heyo. | ||
" | ||
`; | ||
|
||
exports[`static.directory option disabled should not handle request to /other.html (404): console messages 1`] = ` | ||
Array [ | ||
"Failed to load resource: the server responded with a status of 404 (Not Found)", | ||
] | ||
`; | ||
|
||
exports[`static.directory option disabled should not handle request to /other.html (404): page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option disabled should not handle request to /other.html (404): response status 1`] = `404`; | ||
|
||
exports[`static.directory option disabled should not handle request to /other.html (404): response text 1`] = ` | ||
"<!DOCTYPE html> | ||
<html lang=\\"en\\"> | ||
<head> | ||
<meta charset=\\"utf-8\\"> | ||
<title>Error</title> | ||
</head> | ||
<body> | ||
<pre>Cannot GET /index.html</pre> | ||
</body> | ||
</html> | ||
" | ||
`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the default static.serveIndex option (true) should list the files inside the assets folder (200): console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the default static.serveIndex option (true) should list the files inside the assets folder (200): page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the default static.serveIndex option (true) should list the files inside the assets folder (200): response status 1`] = `200`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the default static.serveIndex option (true) should show Heyo. because bar has index.html inside it (200): console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the default static.serveIndex option (true) should show Heyo. because bar has index.html inside it (200): page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the default static.serveIndex option (true) should show Heyo. because bar has index.html inside it (200): response status 1`] = `200`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the default static.serveIndex option (true) should show Heyo. because bar has index.html inside it (200): response text 1`] = ` | ||
"Heyo | ||
" | ||
`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should not list the files inside the assets folder (404): console messages 1`] = ` | ||
Array [ | ||
"Failed to load resource: the server responded with a status of 404 (Not Found)", | ||
] | ||
`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should not list the files inside the assets folder (404): page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should not list the files inside the assets folder (404): response status 1`] = `404`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should not list the files inside the assets folder (404): response text 1`] = ` | ||
"<!DOCTYPE html> | ||
<html lang=\\"en\\"> | ||
<head> | ||
<meta charset=\\"utf-8\\"> | ||
<title>Error</title> | ||
</head> | ||
<body> | ||
<pre>Cannot GET /assets/</pre> | ||
</body> | ||
</html> | ||
" | ||
`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should show Heyo. because bar has index.html inside it (200): console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should show Heyo. because bar has index.html inside it (200): page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should show Heyo. because bar has index.html inside it (200): response status 1`] = `200`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should show Heyo. because bar has index.html inside it (200): response text 1`] = ` | ||
"Heyo | ||
" | ||
`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: true should list the files inside the assets folder (200): console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: true should list the files inside the assets folder (200): page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: true should list the files inside the assets folder (200): response status 1`] = `200`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: true should show Heyo. because bar has index.html inside it (200): console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: true should show Heyo. because bar has index.html inside it (200): page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: true should show Heyo. because bar has index.html inside it (200): response status 1`] = `200`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: true should show Heyo. because bar has index.html inside it (200): response text 1`] = ` | ||
"Heyo | ||
" | ||
`; | ||
|
||
exports[`static.directory option to directory should handle request to index route: console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option to directory should handle request to index route: page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option to directory should handle request to index route: response status 1`] = `200`; | ||
|
||
exports[`static.directory option to directory should handle request to index route: response text 1`] = ` | ||
"Heyo. | ||
" | ||
`; | ||
|
||
exports[`static.directory option to directory should handle request to other file: console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option to directory should handle request to other file: page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option to directory should handle request to other file: response status 1`] = `200`; | ||
|
||
exports[`static.directory option to directory should handle request to other file: response text 1`] = ` | ||
"Other html | ||
" | ||
`; | ||
|
||
exports[`static.directory option to multiple directories should handle request first directory: console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option to multiple directories should handle request first directory: page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option to multiple directories should handle request first directory: response status 1`] = `200`; | ||
|
||
exports[`static.directory option to multiple directories should handle request first directory: response text 1`] = ` | ||
"Heyo. | ||
" | ||
`; | ||
|
||
exports[`static.directory option to multiple directories should handle request to second directory: console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option to multiple directories should handle request to second directory: page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option to multiple directories should handle request to second directory: response status 1`] = `200`; | ||
|
||
exports[`static.directory option to multiple directories should handle request to second directory: response text 1`] = ` | ||
"Foo! | ||
" | ||
`; |
149 changes: 149 additions & 0 deletions
149
test/e2e/__snapshots__/static-directory.test.js.snap.webpack5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,149 @@ | ||
// Jest Snapshot v1, https://goo.gl/fbAQLP | ||
|
||
exports[`static.directory option defaults to PWD should handle request to /index.html: console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option defaults to PWD should handle request to /index.html: page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option defaults to PWD should handle request to /index.html: response status 1`] = `200`; | ||
|
||
exports[`static.directory option defaults to PWD should handle request to /index.html: response text 1`] = ` | ||
"Heyo. | ||
" | ||
`; | ||
|
||
exports[`static.directory option disabled should not handle request to /other.html (404): console messages 1`] = ` | ||
Array [ | ||
"Failed to load resource: the server responded with a status of 404 (Not Found)", | ||
] | ||
`; | ||
|
||
exports[`static.directory option disabled should not handle request to /other.html (404): page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option disabled should not handle request to /other.html (404): response status 1`] = `404`; | ||
|
||
exports[`static.directory option disabled should not handle request to /other.html (404): response text 1`] = ` | ||
"<!DOCTYPE html> | ||
<html lang=\\"en\\"> | ||
<head> | ||
<meta charset=\\"utf-8\\"> | ||
<title>Error</title> | ||
</head> | ||
<body> | ||
<pre>Cannot GET /index.html</pre> | ||
</body> | ||
</html> | ||
" | ||
`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the default static.serveIndex option (true) should list the files inside the assets folder (200): console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the default static.serveIndex option (true) should list the files inside the assets folder (200): page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the default static.serveIndex option (true) should list the files inside the assets folder (200): response status 1`] = `200`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the default static.serveIndex option (true) should show Heyo. because bar has index.html inside it (200): console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the default static.serveIndex option (true) should show Heyo. because bar has index.html inside it (200): page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the default static.serveIndex option (true) should show Heyo. because bar has index.html inside it (200): response status 1`] = `200`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the default static.serveIndex option (true) should show Heyo. because bar has index.html inside it (200): response text 1`] = ` | ||
"Heyo | ||
" | ||
`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should not list the files inside the assets folder (404): console messages 1`] = ` | ||
Array [ | ||
"Failed to load resource: the server responded with a status of 404 (Not Found)", | ||
] | ||
`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should not list the files inside the assets folder (404): page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should not list the files inside the assets folder (404): response status 1`] = `404`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should not list the files inside the assets folder (404): response text 1`] = ` | ||
"<!DOCTYPE html> | ||
<html lang=\\"en\\"> | ||
<head> | ||
<meta charset=\\"utf-8\\"> | ||
<title>Error</title> | ||
</head> | ||
<body> | ||
<pre>Cannot GET /assets/</pre> | ||
</body> | ||
</html> | ||
" | ||
`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should show Heyo. because bar has index.html inside it (200): console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should show Heyo. because bar has index.html inside it (200): page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should show Heyo. because bar has index.html inside it (200): response status 1`] = `200`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: false should show Heyo. because bar has index.html inside it (200): response text 1`] = ` | ||
"Heyo | ||
" | ||
`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: true should list the files inside the assets folder (200): console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: true should list the files inside the assets folder (200): page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: true should list the files inside the assets folder (200): response status 1`] = `200`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: true should show Heyo. because bar has index.html inside it (200): console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: true should show Heyo. because bar has index.html inside it (200): page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: true should show Heyo. because bar has index.html inside it (200): response status 1`] = `200`; | ||
|
||
exports[`static.directory option test listing files in folders without index.html using the option static.serveIndex: true should show Heyo. because bar has index.html inside it (200): response text 1`] = ` | ||
"Heyo | ||
" | ||
`; | ||
|
||
exports[`static.directory option to directory should handle request to index route: console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option to directory should handle request to index route: page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option to directory should handle request to index route: response status 1`] = `200`; | ||
|
||
exports[`static.directory option to directory should handle request to index route: response text 1`] = ` | ||
"Heyo. | ||
" | ||
`; | ||
|
||
exports[`static.directory option to directory should handle request to other file: console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option to directory should handle request to other file: page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option to directory should handle request to other file: response status 1`] = `200`; | ||
|
||
exports[`static.directory option to directory should handle request to other file: response text 1`] = ` | ||
"Other html | ||
" | ||
`; | ||
|
||
exports[`static.directory option to multiple directories should handle request first directory: console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option to multiple directories should handle request first directory: page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option to multiple directories should handle request first directory: response status 1`] = `200`; | ||
|
||
exports[`static.directory option to multiple directories should handle request first directory: response text 1`] = ` | ||
"Heyo. | ||
" | ||
`; | ||
|
||
exports[`static.directory option to multiple directories should handle request to second directory: console messages 1`] = `Array []`; | ||
|
||
exports[`static.directory option to multiple directories should handle request to second directory: page errors 1`] = `Array []`; | ||
|
||
exports[`static.directory option to multiple directories should handle request to second directory: response status 1`] = `200`; | ||
|
||
exports[`static.directory option to multiple directories should handle request to second directory: response text 1`] = ` | ||
"Foo! | ||
" | ||
`; |
Oops, something went wrong.