Skip to content

Commit 26c4e49

Browse files
committed
test: add e2e tests for proxy option
1 parent e5d3e83 commit 26c4e49

File tree

2 files changed

+579
-0
lines changed

2 files changed

+579
-0
lines changed
Lines changed: 119 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,119 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`proxy option as an object of paths with properties byPass can rewrite a request path regardless of the target defined a bypass option: console messages 1`] = `Array []`;
4+
5+
exports[`proxy option as an object of paths with properties byPass can rewrite a request path regardless of the target defined a bypass option: page errors 1`] = `Array []`;
6+
7+
exports[`proxy option as an object of paths with properties byPass can rewrite a request path regardless of the target defined a bypass option: response status 1`] = `200`;
8+
9+
exports[`proxy option as an object of paths with properties byPass can rewrite a request path regardless of the target defined a bypass option: response text 1`] = `
10+
"Hello
11+
"
12+
`;
13+
14+
exports[`proxy option as an object of paths with properties byPass can rewrite a request path: console messages 1`] = `Array []`;
15+
16+
exports[`proxy option as an object of paths with properties byPass can rewrite a request path: page errors 1`] = `Array []`;
17+
18+
exports[`proxy option as an object of paths with properties byPass can rewrite a request path: response status 1`] = `200`;
19+
20+
exports[`proxy option as an object of paths with properties byPass can rewrite a request path: response text 1`] = `
21+
"Hello
22+
"
23+
`;
24+
25+
exports[`proxy option as an object of paths with properties byPass should not pass through a proxy when a bypass function returns false: console messages 1`] = `
26+
Array [
27+
"Failed to load resource: the server responded with a status of 404 (Not Found)",
28+
]
29+
`;
30+
31+
exports[`proxy option as an object of paths with properties byPass should not pass through a proxy when a bypass function returns false: page errors 1`] = `Array []`;
32+
33+
exports[`proxy option as an object of paths with properties byPass should not pass through a proxy when a bypass function returns false: response status 1`] = `404`;
34+
35+
exports[`proxy option as an object of paths with properties byPass should not pass through a proxy when a bypass function returns false: response text 1`] = `
36+
"<!DOCTYPE html>
37+
<html lang=\\"en\\">
38+
<head>
39+
<meta charset=\\"utf-8\\">
40+
<title>Error</title>
41+
</head>
42+
<body>
43+
<pre>Cannot GET /proxyfalse</pre>
44+
</body>
45+
</html>
46+
"
47+
`;
48+
49+
exports[`proxy option as an object of paths with properties byPass should pass through a proxy when a bypass function returns null: console messages 1`] = `Array []`;
50+
51+
exports[`proxy option as an object of paths with properties byPass should pass through a proxy when a bypass function returns null: page errors 1`] = `Array []`;
52+
53+
exports[`proxy option as an object of paths with properties byPass should pass through a proxy when a bypass function returns null: response status 1`] = `200`;
54+
55+
exports[`proxy option as an object of paths with properties byPass should pass through a proxy when a bypass function returns null: response text 1`] = `
56+
"\\"use strict\\";
57+
58+
console.log(\\"Hey.\\");
59+
"
60+
`;
61+
62+
exports[`proxy option as an object of paths with properties byPass should wait if bypass returns promise: console messages 1`] = `Array []`;
63+
64+
exports[`proxy option as an object of paths with properties byPass should wait if bypass returns promise: page errors 1`] = `Array []`;
65+
66+
exports[`proxy option as an object of paths with properties byPass should wait if bypass returns promise: response status 1`] = `200`;
67+
68+
exports[`proxy option as an object of paths with properties byPass should wait if bypass returns promise: response text 1`] = `"proxy async response"`;
69+
70+
exports[`proxy option as an object of paths with properties byPass should work with the 'target' option #2: console messages 1`] = `Array []`;
71+
72+
exports[`proxy option as an object of paths with properties byPass should work with the 'target' option #2: page errors 1`] = `Array []`;
73+
74+
exports[`proxy option as an object of paths with properties byPass should work with the 'target' option #2: response status 1`] = `200`;
75+
76+
exports[`proxy option as an object of paths with properties byPass should work with the 'target' option #2: response text 1`] = `
77+
"Hello
78+
"
79+
`;
80+
81+
exports[`proxy option as an object of paths with properties byPass should work with the 'target' option: console messages 1`] = `
82+
Array [
83+
"Failed to load resource: the server responded with a status of 404 (Not Found)",
84+
]
85+
`;
86+
87+
exports[`proxy option as an object of paths with properties byPass should work with the 'target' option: page errors 1`] = `Array []`;
88+
89+
exports[`proxy option as an object of paths with properties byPass should work with the 'target' option: response status 1`] = `404`;
90+
91+
exports[`proxy option as an object of paths with properties byPass should work with the 'target' option: response text 1`] = `
92+
"<!DOCTYPE html>
93+
<html lang=\\"en\\">
94+
<head>
95+
<meta charset=\\"utf-8\\">
96+
<title>Error</title>
97+
</head>
98+
<body>
99+
<pre>Cannot GET /bypass-with-target/foo.js</pre>
100+
</body>
101+
</html>
102+
"
103+
`;
104+
105+
exports[`proxy option as an object of paths with properties pathRewrite respects a pathRewrite option: console messages 1`] = `Array []`;
106+
107+
exports[`proxy option as an object of paths with properties pathRewrite respects a pathRewrite option: page errors 1`] = `Array []`;
108+
109+
exports[`proxy option as an object of paths with properties pathRewrite respects a pathRewrite option: response status 1`] = `200`;
110+
111+
exports[`proxy option as an object of paths with properties pathRewrite respects a pathRewrite option: response text 1`] = `"from proxy2"`;
112+
113+
exports[`proxy option as an object of paths with properties target respects a proxy option when a request path is matched: console messages 1`] = `Array []`;
114+
115+
exports[`proxy option as an object of paths with properties target respects a proxy option when a request path is matched: page errors 1`] = `Array []`;
116+
117+
exports[`proxy option as an object of paths with properties target respects a proxy option when a request path is matched: response status 1`] = `200`;
118+
119+
exports[`proxy option as an object of paths with properties target respects a proxy option when a request path is matched: response text 1`] = `"from proxy1"`;

0 commit comments

Comments
 (0)