MCPcopy
hub / github.com/alibaba/anyproxy / testHttpsConnect

Function testHttpsConnect

test/spec_rule/rule_deal_error_spec.js:118–154  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

116}
117
118function testHttpsConnect() {
119 describe('Rule should get a connect error', () => {
120 let proxyServer;
121 // let serverInstance;
122
123 beforeAll((done) => {
124 errorInConnect = null;
125 jasmine.DEFAULT_TIMEOUT_INTERVAL = 50000;
126 printLog('Start server for rule_deal_error_custom_error_page');
127
128 proxyServer = ProxyServerUtil.proxyServerWithRule(ruleDealConnectError, {
129 forceProxyHttps: false
130 });
131
132 setTimeout(() => {
133 done();
134 }, 2000);
135 });
136
137 afterAll(() => {
138 proxyServer && proxyServer.close();
139 printLog('Close server for rule_deal_error_custom_error_page');
140 });
141
142 it('Should get a request error', done => {
143 const url = 'https://not_exist_url.anyproxy.io';
144 proxyGet(url)
145 .then(proxyRes => {
146 done.fail('should throw an error when requesting');
147 })
148 .catch(error => {
149 expect(errorInConnect).not.toBe(null);
150 done();
151 });
152 });
153 });
154}

Callers 1

Calls 3

proxyGetFunction · 0.85
printLogFunction · 0.50
closeMethod · 0.45

Tested by

no test coverage detected