(data)
| 11031 | if (matchedMockDispatches.length === 0) { |
| 11032 | throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`); |
| 11033 | } |
| 11034 | matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue(method, key.method)); |
| 11035 | if (matchedMockDispatches.length === 0) { |
| 11036 | throw new MockNotMatchedError(`Mock dispatch not matched for method '${key.method}' on path '${resolvedPath}'`); |
| 11037 | } |
| 11038 | matchedMockDispatches = matchedMockDispatches.filter(({ body }) => typeof body !== "undefined" ? matchValue(body, key.body) : true); |
| 11039 | if (matchedMockDispatches.length === 0) { |
| 11040 | throw new MockNotMatchedError(`Mock dispatch not matched for body '${key.body}' on path '${resolvedPath}'`); |
| 11041 | } |
| 11042 | matchedMockDispatches = matchedMockDispatches.filter((mockDispatch2) => matchHeaders(mockDispatch2, key.headers)); |
| 11043 | if (matchedMockDispatches.length === 0) { |
| 11044 | const headers = typeof key.headers === "object" ? JSON.stringify(key.headers) : key.headers; |
| 11045 | throw new MockNotMatchedError(`Mock dispatch not matched for headers '${headers}' on path '${resolvedPath}'`); |
| 11046 | } |
| 11047 | return matchedMockDispatches[0]; |
| 11048 | } |
| 11049 | function addMockDispatch(mockDispatches, key, data) { |
| 11050 | const baseData = { timesInvoked: 0, times: 1, persist: false, consumed: false }; |
| 11051 | const replyData = typeof data === "function" ? { callback: data } : __spreadValues({}, data); |
| 11052 | const newMockDispatch = __spreadProps(__spreadValues(__spreadValues({}, baseData), key), { pending: true, data: __spreadValues({ error: null }, replyData) }); |
no test coverage detected