You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
More quickly understanding which mocked endpoint is not matching on MockNotMatchedError
MockNotMatchedError: Mock dispatch not matched for method 'POST': subsequent request to origin https://discord.com was not allowed (net.connect disabled)
🤔☝️ what endpoint is this not matching for???
The implementation should look like...
In mock-utils.js>getMockDispatch, there are a series of matchedMockDispatches checks.
let matchedMockDispatches = mockDispatches.filter(({ consumed }) => !consumed).filter(({ path }) => matchValue(path, resolvedPath))
if (matchedMockDispatches.length === 0) {
throw new MockNotMatchedError(`Mock dispatch not matched for path '${resolvedPath}'`)
}
// Match method
matchedMockDispatches = matchedMockDispatches.filter(({ method }) => matchValue(method, key.method))
if (matchedMockDispatches.length === 0) {
throw new MockNotMatchedError(`Mock dispatch not matched for method '${key.method}'`)
}
If the first check passes, we know we've matched resolvedPath. Therefore, we can add this to the error messages in subsequent checks so that its easier to track down the MockNotMatchedError source.
For example, if we don't match the request method, the error could be:
throw new MockNotMatchedError(`Mock dispatch not matched for method '${key.method}' on path '${resolvedPath}'`)
Then, in our original error message, we'd know our POST request isn't matching on path /api/channels/123/messages
The text was updated successfully, but these errors were encountered:
This would solve...
More quickly understanding which mocked endpoint is not matching on
MockNotMatchedError
🤔☝️ what endpoint is this not matching for???
The implementation should look like...
In
mock-utils.js>getMockDispatch
, there are a series ofmatchedMockDispatches
checks.If the first check passes, we know we've matched
resolvedPath
. Therefore, we can add this to the error messages in subsequent checks so that its easier to track down theMockNotMatchedError
source.For example, if we don't match the request method, the error could be:
Then, in our original error message, we'd know our
POST
request isn't matchingon path /api/channels/123/messages
The text was updated successfully, but these errors were encountered: