I'm using Bookshelf and trying to mock two different scenarios for a function which sets up an endpoint.
The data passed into the function is the same for both scenarios; the only difference is that in the second scenario, one of the returned objects has a different value for a property that tells us how many endpoints are already registered, which should then trigger an error telling us the limit has been reached.
I've created arrays of mock return functions, and am passing them into the test. Unfortunately, they both trigger the limit error. It feels like I don't understand the way Mock-Knex is loading the arrays.
I'm using Bookshelf and trying to mock two different scenarios for a function which sets up an endpoint.
The data passed into the function is the same for both scenarios; the only difference is that in the second scenario, one of the returned objects has a different value for a property that tells us how many endpoints are already registered, which should then trigger an error telling us the limit has been reached.
I've created arrays of mock return functions, and am passing them into the test. Unfortunately, they both trigger the limit error. It feels like I don't understand the way Mock-Knex is loading the arrays.
Here are my return function arrays:
And here are my tests:
Please help me understand what I'm doing wrong.