Skip to content

Commit e7c7009

Browse files
authored
test: add e2e tests for static.directory option (#3802)
1 parent a343cd7 commit e7c7009

4 files changed

+986
-399
lines changed
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`static.directory option defaults to PWD should handle request to /index.html: console messages 1`] = `Array []`;
4+
5+
exports[`static.directory option defaults to PWD should handle request to /index.html: page errors 1`] = `Array []`;
6+
7+
exports[`static.directory option defaults to PWD should handle request to /index.html: response status 1`] = `200`;
8+
9+
exports[`static.directory option defaults to PWD should handle request to /index.html: response text 1`] = `
10+
"Heyo.
11+
"
12+
`;
13+
14+
exports[`static.directory option disabled should not handle request to /other.html (404): console messages 1`] = `
15+
Array [
16+
"Failed to load resource: the server responded with a status of 404 (Not Found)",
17+
]
18+
`;
19+
20+
exports[`static.directory option disabled should not handle request to /other.html (404): page errors 1`] = `Array []`;
21+
22+
exports[`static.directory option disabled should not handle request to /other.html (404): response status 1`] = `404`;
23+
24+
exports[`static.directory option disabled should not handle request to /other.html (404): response text 1`] = `
25+
"<!DOCTYPE html>
26+
<html lang=\\"en\\">
27+
<head>
28+
<meta charset=\\"utf-8\\">
29+
<title>Error</title>
30+
</head>
31+
<body>
32+
<pre>Cannot GET /index.html</pre>
33+
</body>
34+
</html>
35+
"
36+
`;
37+
38+
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 []`;
39+
40+
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 []`;
41+
42+
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`;
43+
44+
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 []`;
45+
46+
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 []`;
47+
48+
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`;
49+
50+
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`] = `
51+
"Heyo
52+
"
53+
`;
54+
55+
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`] = `
56+
Array [
57+
"Failed to load resource: the server responded with a status of 404 (Not Found)",
58+
]
59+
`;
60+
61+
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 []`;
62+
63+
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`;
64+
65+
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`] = `
66+
"<!DOCTYPE html>
67+
<html lang=\\"en\\">
68+
<head>
69+
<meta charset=\\"utf-8\\">
70+
<title>Error</title>
71+
</head>
72+
<body>
73+
<pre>Cannot GET /assets/</pre>
74+
</body>
75+
</html>
76+
"
77+
`;
78+
79+
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 []`;
80+
81+
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 []`;
82+
83+
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`;
84+
85+
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`] = `
86+
"Heyo
87+
"
88+
`;
89+
90+
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 []`;
91+
92+
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 []`;
93+
94+
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`;
95+
96+
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 []`;
97+
98+
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 []`;
99+
100+
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`;
101+
102+
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`] = `
103+
"Heyo
104+
"
105+
`;
106+
107+
exports[`static.directory option to directory should handle request to index route: console messages 1`] = `Array []`;
108+
109+
exports[`static.directory option to directory should handle request to index route: page errors 1`] = `Array []`;
110+
111+
exports[`static.directory option to directory should handle request to index route: response status 1`] = `200`;
112+
113+
exports[`static.directory option to directory should handle request to index route: response text 1`] = `
114+
"Heyo.
115+
"
116+
`;
117+
118+
exports[`static.directory option to directory should handle request to other file: console messages 1`] = `Array []`;
119+
120+
exports[`static.directory option to directory should handle request to other file: page errors 1`] = `Array []`;
121+
122+
exports[`static.directory option to directory should handle request to other file: response status 1`] = `200`;
123+
124+
exports[`static.directory option to directory should handle request to other file: response text 1`] = `
125+
"Other html
126+
"
127+
`;
128+
129+
exports[`static.directory option to multiple directories should handle request first directory: console messages 1`] = `Array []`;
130+
131+
exports[`static.directory option to multiple directories should handle request first directory: page errors 1`] = `Array []`;
132+
133+
exports[`static.directory option to multiple directories should handle request first directory: response status 1`] = `200`;
134+
135+
exports[`static.directory option to multiple directories should handle request first directory: response text 1`] = `
136+
"Heyo.
137+
"
138+
`;
139+
140+
exports[`static.directory option to multiple directories should handle request to second directory: console messages 1`] = `Array []`;
141+
142+
exports[`static.directory option to multiple directories should handle request to second directory: page errors 1`] = `Array []`;
143+
144+
exports[`static.directory option to multiple directories should handle request to second directory: response status 1`] = `200`;
145+
146+
exports[`static.directory option to multiple directories should handle request to second directory: response text 1`] = `
147+
"Foo!
148+
"
149+
`;
Lines changed: 149 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,149 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`static.directory option defaults to PWD should handle request to /index.html: console messages 1`] = `Array []`;
4+
5+
exports[`static.directory option defaults to PWD should handle request to /index.html: page errors 1`] = `Array []`;
6+
7+
exports[`static.directory option defaults to PWD should handle request to /index.html: response status 1`] = `200`;
8+
9+
exports[`static.directory option defaults to PWD should handle request to /index.html: response text 1`] = `
10+
"Heyo.
11+
"
12+
`;
13+
14+
exports[`static.directory option disabled should not handle request to /other.html (404): console messages 1`] = `
15+
Array [
16+
"Failed to load resource: the server responded with a status of 404 (Not Found)",
17+
]
18+
`;
19+
20+
exports[`static.directory option disabled should not handle request to /other.html (404): page errors 1`] = `Array []`;
21+
22+
exports[`static.directory option disabled should not handle request to /other.html (404): response status 1`] = `404`;
23+
24+
exports[`static.directory option disabled should not handle request to /other.html (404): response text 1`] = `
25+
"<!DOCTYPE html>
26+
<html lang=\\"en\\">
27+
<head>
28+
<meta charset=\\"utf-8\\">
29+
<title>Error</title>
30+
</head>
31+
<body>
32+
<pre>Cannot GET /index.html</pre>
33+
</body>
34+
</html>
35+
"
36+
`;
37+
38+
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 []`;
39+
40+
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 []`;
41+
42+
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`;
43+
44+
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 []`;
45+
46+
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 []`;
47+
48+
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`;
49+
50+
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`] = `
51+
"Heyo
52+
"
53+
`;
54+
55+
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`] = `
56+
Array [
57+
"Failed to load resource: the server responded with a status of 404 (Not Found)",
58+
]
59+
`;
60+
61+
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 []`;
62+
63+
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`;
64+
65+
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`] = `
66+
"<!DOCTYPE html>
67+
<html lang=\\"en\\">
68+
<head>
69+
<meta charset=\\"utf-8\\">
70+
<title>Error</title>
71+
</head>
72+
<body>
73+
<pre>Cannot GET /assets/</pre>
74+
</body>
75+
</html>
76+
"
77+
`;
78+
79+
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 []`;
80+
81+
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 []`;
82+
83+
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`;
84+
85+
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`] = `
86+
"Heyo
87+
"
88+
`;
89+
90+
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 []`;
91+
92+
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 []`;
93+
94+
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`;
95+
96+
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 []`;
97+
98+
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 []`;
99+
100+
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`;
101+
102+
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`] = `
103+
"Heyo
104+
"
105+
`;
106+
107+
exports[`static.directory option to directory should handle request to index route: console messages 1`] = `Array []`;
108+
109+
exports[`static.directory option to directory should handle request to index route: page errors 1`] = `Array []`;
110+
111+
exports[`static.directory option to directory should handle request to index route: response status 1`] = `200`;
112+
113+
exports[`static.directory option to directory should handle request to index route: response text 1`] = `
114+
"Heyo.
115+
"
116+
`;
117+
118+
exports[`static.directory option to directory should handle request to other file: console messages 1`] = `Array []`;
119+
120+
exports[`static.directory option to directory should handle request to other file: page errors 1`] = `Array []`;
121+
122+
exports[`static.directory option to directory should handle request to other file: response status 1`] = `200`;
123+
124+
exports[`static.directory option to directory should handle request to other file: response text 1`] = `
125+
"Other html
126+
"
127+
`;
128+
129+
exports[`static.directory option to multiple directories should handle request first directory: console messages 1`] = `Array []`;
130+
131+
exports[`static.directory option to multiple directories should handle request first directory: page errors 1`] = `Array []`;
132+
133+
exports[`static.directory option to multiple directories should handle request first directory: response status 1`] = `200`;
134+
135+
exports[`static.directory option to multiple directories should handle request first directory: response text 1`] = `
136+
"Heyo.
137+
"
138+
`;
139+
140+
exports[`static.directory option to multiple directories should handle request to second directory: console messages 1`] = `Array []`;
141+
142+
exports[`static.directory option to multiple directories should handle request to second directory: page errors 1`] = `Array []`;
143+
144+
exports[`static.directory option to multiple directories should handle request to second directory: response status 1`] = `200`;
145+
146+
exports[`static.directory option to multiple directories should handle request to second directory: response text 1`] = `
147+
"Foo!
148+
"
149+
`;

0 commit comments

Comments
 (0)