(mockDispatches, key, data)
| 57261 | throw new MockNotMatchedError(`Mock dispatch not matched for body '${key.body}'`); |
| 57262 | } |
| 57263 | matchedMockDispatches = matchedMockDispatches.filter((mockDispatch2) => matchHeaders(mockDispatch2, key.headers)); |
| 57264 | if (matchedMockDispatches.length === 0) { |
| 57265 | throw new MockNotMatchedError(`Mock dispatch not matched for headers '${typeof key.headers === "object" ? JSON.stringify(key.headers) : key.headers}'`); |
| 57266 | } |
| 57267 | return matchedMockDispatches[0]; |
| 57268 | } |
| 57269 | function addMockDispatch(mockDispatches, key, data) { |
| 57270 | const baseData = { timesInvoked: 0, times: 1, persist: false, consumed: false }; |
| 57271 | const replyData = typeof data === "function" ? { callback: data } : { ...data }; |
| 57272 | const newMockDispatch = { ...baseData, ...key, pending: true, data: { error: null, ...replyData } }; |
no test coverage detected
searching dependent graphs…