()
| 116 | } |
| 117 | |
| 118 | function 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 | } |
no test coverage detected