Wildcard Mock Not Working
AdrianHL opened this issue · comments
Adrian Hernandez Lopez commented
Hi,
I have some tests that require wildcards (see example below) but it doesn't look to be working as expected (the requests is not mocked).
moxios.stubRequest('/comments/.*/vote', { status: 200, response: { success: true } })
Any idea why this could be happening?
Thanks in advance
Guilherme Jacomini commented
Hi mate!
I may be wrong, but I think wildcards should be RegExp, not strings, as in the example from README:
// Alternatively URL can be a RegExp
moxios.stubRequest(/say.*/, {/* ... */})
Try using /comments\/.*\/vote/
(without quotes).