Is it possible to use wild cards in angular mocks? for example:
$httpBackend.when('GET', '/api/checklists/*').respond({ userId: 'userX' }, { 'A-Token': 'xxx' });
rather than:
$httpBackend.when('GET', '/api/checklists/123').respond({ userId: 'userX' }, { 'A-Token': 'xxx' });
The documentation suggests that it takes in a regular expression, so you can do something like this:
$httpBackend.when('GET', /\/api\/checklists\/[1-9][0-9]*/)
This will require the match an integer ID with a length of at least 1, not starting with zero. Of course, this is just an example. Create your own regular expressions to match.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With