()
| 4 | |
| 5 | class MockXMLHttpRequest { |
| 6 | constructor() { |
| 7 | this.requestHeaders = {}; |
| 8 | this.responseHeaders = {}; |
| 9 | this.readyState = 0; |
| 10 | this.status = 0; |
| 11 | this.statusText = ''; |
| 12 | this.responseText = ''; |
| 13 | this.response = null; |
| 14 | this.timeout = 0; |
| 15 | this.withCredentials = false; |
| 16 | this.onreadystatechange = null; |
| 17 | this.onloadend = null; |
| 18 | this.onabort = null; |
| 19 | this.onerror = null; |
| 20 | this.ontimeout = null; |
| 21 | this._listeners = {}; |
| 22 | this._uploadListeners = {}; |
| 23 | this.upload = { |
| 24 | addEventListener: (type, listener) => { |
| 25 | this._uploadListeners[type] ||= []; |
| 26 | this._uploadListeners[type].push(listener); |
| 27 | }, |
| 28 | }; |
| 29 | } |
| 30 | |
| 31 | open(method, url, async = true) { |
| 32 | this.method = method; |
nothing calls this directly
no outgoing calls
no test coverage detected