(data)
| 11031 | const bodyMatch = typeof mockDispatch2.body !== "undefined" ? matchValue(mockDispatch2.body, body) : true; |
| 11032 | const headersMatch = matchHeaders(mockDispatch2, headers); |
| 11033 | return pathMatch && methodMatch && bodyMatch && headersMatch; |
| 11034 | } |
| 11035 | function getResponseData(data) { |
| 11036 | if (Buffer.isBuffer(data)) { |
| 11037 | return data; |
| 11038 | } else if (data instanceof Uint8Array) { |
| 11039 | return data; |
| 11040 | } else if (data instanceof ArrayBuffer) { |
| 11041 | return data; |
| 11042 | } else if (typeof data === "object") { |
| 11043 | return JSON.stringify(data); |
| 11044 | } else { |
| 11045 | return data.toString(); |
| 11046 | } |
| 11047 | } |
| 11048 | function getMockDispatch(mockDispatches, key) { |
| 11049 | const basePath = key.query ? buildURL(key.path, key.query) : key.path; |
| 11050 | const resolvedPath = typeof basePath === "string" ? safeUrl(basePath) : basePath; |
| 11051 | let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path4 }) => matchValue(safeUrl(path4), resolvedPath)); |
| 11052 | if (matchedMockDispatches.length === 0) { |
no test coverage detected