(mockDispatch2, headers)
| 57191 | function buildHeadersFromArray(headers) { |
| 57192 | const clone = headers.slice(); |
| 57193 | const entries = []; |
| 57194 | for (let index = 0; index < clone.length; index += 2) { |
| 57195 | entries.push([clone[index], clone[index + 1]]); |
| 57196 | } |
| 57197 | return Object.fromEntries(entries); |
| 57198 | } |
| 57199 | function matchHeaders(mockDispatch2, headers) { |
| 57200 | if (typeof mockDispatch2.headers === "function") { |
| 57201 | if (Array.isArray(headers)) { |
| 57202 | headers = buildHeadersFromArray(headers); |
| 57203 | } |
| 57204 | return mockDispatch2.headers(headers ? lowerCaseEntries(headers) : {}); |
| 57205 | } |
| 57206 | if (typeof mockDispatch2.headers === "undefined") { |
| 57207 | return true; |
| 57208 | } |
| 57209 | if (typeof headers !== "object" || typeof mockDispatch2.headers !== "object") { |
| 57210 | return false; |
| 57211 | } |
| 57212 | for (const [matchHeaderName, matchHeaderValue2] of Object.entries(mockDispatch2.headers)) { |
| 57213 | const headerValue = getHeaderByName(headers, matchHeaderName); |
| 57214 | if (!matchValue(matchHeaderValue2, headerValue)) { |
| 57215 | return false; |
| 57216 | } |
no test coverage detected
searching dependent graphs…