-
Notifications
You must be signed in to change notification settings - Fork 42
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using with vue component tests #80
Comments
Hi, it looks like your example is incomplete. You're initializing |
@kingjan1999 Thank you for the very quick response and you are indeed correct. I forgot to ask where would I call it as the example in the readme, it is used as follows: UppercaseProxy(clientMessage)
.then(thenFn)
.catch(catchFn); I tried doing this but it didn't work as expected since the render function doesn't return a render(Component, {
localVue,
store: store,
})
}).then(thenFn)
.catch(catchFn); |
@nirajfu3e In the readme example, |
@kingjan1999 That makes perfect sense and that is how I was planning to test it - by checking what was actually rendered by Vue. For some reason the mocked data set with Am I correct in assuming that when we simulate the server response, on Thanks. |
@nirajfu3e That's exactly what should happen, yes. Can you check whether the |
@kingjan1999 I did I tried creating a CodeSandbox but for some reason the setup is not working on it but I have got the tests with an API mocked there. |
I am trying to use the package with a axion request on a vue component following the basic example but maybe I am not understanding the basics here, I can't get a
then
spy to have been called.Then the test which uses vue-testing-library is as follows
In the test the first assertion (
expect(mockAxios.post).toHaveBeenCalledWith('/search', {term: term });
) works as expected. It mocks the response as well but it fails on theexpect(thenFn).toHaveBeenCalled();
showing there were 0 calls forthenFn
.I was also expecting the results on the
this.results = data
to be populated with the mocked response data and the template updated, just like when you get a response from an actual api endpoint would but it looks like that never happens. Am I missing something here?The text was updated successfully, but these errors were encountered: