(body)
| 11051 | let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path: path4 }) => matchValue(safeUrl(path4), resolvedPath)); |
| 11052 | if (matchedMockDispatches.length === 0) { |
| 11053 | throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`); |
| 11054 | } |
| 11055 | matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue(method, key.method)); |
| 11056 | if (matchedMockDispatches.length === 0) { |
| 11057 | throw new MockNotMatchedError(`Mock dispatch not matched for method '${key.method}' on path '${resolvedPath}'`); |
| 11058 | } |
| 11059 | matchedMockDispatches = matchedMockDispatches.filter(({ body }) => typeof body !== "undefined" ? matchValue(body, key.body) : true); |
| 11060 | if (matchedMockDispatches.length === 0) { |
| 11061 | throw new MockNotMatchedError(`Mock dispatch not matched for body '${key.body}' on path '${resolvedPath}'`); |
| 11062 | } |
| 11063 | matchedMockDispatches = matchedMockDispatches.filter((mockDispatch2) => matchHeaders(mockDispatch2, key.headers)); |
| 11064 | if (matchedMockDispatches.length === 0) { |
| 11065 | const headers = typeof key.headers === "object" ? JSON.stringify(key.headers) : key.headers; |
| 11066 | throw new MockNotMatchedError(`Mock dispatch not matched for headers '${headers}' on path '${resolvedPath}'`); |
| 11067 | } |
| 11068 | return matchedMockDispatches[0]; |
| 11069 | } |
| 11070 | function addMockDispatch(mockDispatches, key, data) { |
| 11071 | const baseData = { timesInvoked: 0, times: 1, persist: false, consumed: false }; |
| 11072 | const replyData = typeof data === "function" ? { callback: data } : __spreadValues({}, data); |
| 11073 | const newMockDispatch = __spreadProps(__spreadValues(__spreadValues({}, baseData), key), { pending: true, data: __spreadValues({ error: null }, replyData) }); |
| 11074 | mockDispatches.push(newMockDispatch); |
| 11075 | return newMockDispatch; |
| 11076 | } |
nothing calls this directly
no test coverage detected