Seems stubRequest doesn't work inside withMock.
If I use moxios.install()/uninstall() in beforeEach/afterEach stubRequest() works good.
If I use just withMock() without stubRequest and then
moxios.wait(...
moxios.requests.mostRecent().respondWith(...).then(...)
...
it works good too.
But if I use it this way
describe('Test suite', function () {
it('#1', function (done) {
moxios.withMock(function () {
moxios.stubRequest('/say/hello', {
status: 200,
responseText: 'hello'
})
let onFulfilled = jasmine.createSpy('spy1')
axios.get('/say/hello').then(onFulfilled)
moxios.wait(function () {
expect(onFulfilled.calls.mostRecent().args[0].data).toBe('hello')
done()
})
})
})
})
it doesn't work.
Seems
stubRequestdoesn't work insidewithMock.If I use
moxios.install()/uninstall()in beforeEach/afterEachstubRequest()works good.If I use just
withMock()withoutstubRequestand thenit works good too.
But if I use it this way
it doesn't work.