miragejs/ember-cli-mirage

Issues with integrating mirage in integration test

ahemed-haneen opened this issue · 3 comments

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?

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.

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.

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.