Skip to content
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

How to mock requests to custom endpoints in integration test #230

Closed
brancusi opened this issue Aug 5, 2016 · 3 comments
Closed

How to mock requests to custom endpoints in integration test #230

brancusi opened this issue Aug 5, 2016 · 3 comments

Comments

@brancusi
Copy link

brancusi commented Aug 5, 2016

Hi,

Here is the use case:

Trying to test a component that uses the google place autocomplete.

I need to mock the auth and query requests.

For some reason, in the integration test, mockJax does not seem to match any requests when a handler is created directly through the mockJax global.

We've tried using $.mockJax and Ember.$.mockJax.

Neither intercept any of the requests.

Any ideas?

Thanks

@danielspaniel
Copy link
Collaborator

maybe simple as this:

    let widget = this.build('widget', 'withExtras').get();
    Ember.$.mockjax({ url: `/my/custom/widget`, responseText: widget, type: 'GET' });

as in ( lowercase the mockjax )

@danielspaniel
Copy link
Collaborator

did this work for you?

@brancusi
Copy link
Author

Thank you. I haven't had a chance to try it yet since we skipped that test for now. Will close and keep you posted once I try it out.

Thanks again

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants