Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: add e2e tests for static.directory option #3802

Merged
merged 1 commit into from Sep 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
149 changes: 149 additions & 0 deletions test/e2e/__snapshots__/static-directory.test.js.snap.webpack4
@@ -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 test/e2e/__snapshots__/static-directory.test.js.snap.webpack5
@@ -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!
"
`;