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

Issues with integrating mirage in integration test #2224

Open
ahemed-haneen opened this issue Aug 20, 2021 · 3 comments
Open

Issues with integrating mirage in integration test #2224

ahemed-haneen opened this issue Aug 20, 2021 · 3 comments

Comments

@ahemed-haneen
Copy link

Im trying to use mirage with ember-orbit in integration test.

based on the discussion from this issue and the docs i had tried to solve this.

but im having issues with

  1. pushPayload is not a function in orbitjs.
  2. i tried pushing to orbit cache. but this is throwing errors in my serializer.

any idea how to fix these issues?

@cah-brian-gantzler
Copy link
Collaborator

PushPayload is definitely an ember data concern and would not be applicable to orbit.

When you do things like server.createList, it creates data in the mirage server. Then when you make back end calls Mirage would serve that data. Is your code in your test making the calls that mirage would intercept?

If you are going to push data into the orbit cache directly and mock so the backend calls dont happen, you dont actually need mirage in this case.

Would need more information than what you have above to possibly help.

@ahemed-haneen
Copy link
Author

i'm using mirage to intercept the requests that are getting generated by orbit.

acc. to my understanding ember orbit is equivalent to ember data so is was planning to

do this
https://www.ember-cli-mirage.com/versions/master/docs/testing/integration-and-unit-tests#writing-a-helper-to-push-mirage-s-database

but with ember orbit.

@cah-brian-gantzler
Copy link
Collaborator

That helper would not be used if you are letting orbit make the calls. That helper was intended to be used if, you created a bunch of data in the mirage server, you then wanted to run a test and have that data in the ember data store WITHOUT actually making the calls to mirage. It has a very limited use case.

An example would be if you had a cache that was loaded at start up (make several calls), and several tests need that cache loaded. Rather than calling the code to load the cache, making the calls, etc for each test, you just wanted to mirage tables forced into the ember data tables and by pass calling your cache code to load the cache, you might use that helper.

Note that helper is old and not very flexible. I provided an updated one in a PR that was never accepted. You can find that here https://github.com/miragejs/ember-cli-mirage/pull/2001/files#diff-b9a755d2bcd82614e4cfd6558280014a31a55569103275b7d5ba6f0ea828322d.

Based on what you have said so far, you should not need to use that helper.

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