I'm trying to nock a route call while checking that the passed request body adheres to my assumptions. This route is called multiple times to test three inheriting implementations. The call is the same except that a single value (param3 below) in the request body will differ in value.
nock('someAddress')
.post('/path', {
param1: [someArray],
param2: someInteger,
param3: /[0-9]+/ /* param3 has varying positive integer values */
})
.reply(200, { responseObject });
If I put the exact value for param3, I can get the first iteration of the test to succeed. I can also get the test to work by not specifying the request body at all, obviously. However, if I either just leave out param3 or try to specify various wildcard parameters such as the regex in the example, I always get the following error message:
[route] 404 error: Nock: No match for request POST [someAddress/path] {"param1":[someArray],"param2":someInteger,"param3":exactValueOfThisCall}
How can I check my request body in a nock intercept but allow a single parameter to have various integer values?