Skip to content

Commit

Permalink
test: add e2e tests for static.directory option (#3802)
Browse files Browse the repository at this point in the history
  • Loading branch information
snitin315 committed Sep 6, 2021
1 parent a343cd7 commit e7c7009
Show file tree
Hide file tree
Showing 4 changed files with 986 additions and 399 deletions.
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!
"
`;

0 comments on commit e7c7009

Please sign in to comment.