Skip to content

stubRequest inside withMock doesn't work #72

Open
@bam

Description

@bam

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.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions